SDK:error code 3

Plug-in and third party software discussion.
Post Reply
brindy
Posts: 7
Joined: Fri Nov 16, 2018 12:20 pm

SDK:error code 3

Post by brindy »

I run the SDK under the Debug x86 and also x64 on the vs 2015

Return Value is 3.
I finded the 3 means EVERYTHING_ERROR_REGISTERCLASSEX ----->unable to register window class.

Code: Select all

int main(int argc,char **argv)
{
	printf("SDK test\n");
	
	Everything_SetSearchW(L"brindy");
	Everything_SetRequestFlags(EVERYTHING_REQUEST_FILE_NAME|EVERYTHING_REQUEST_PATH|EVERYTHING_REQUEST_SIZE);
	Everything_SetSort(EVERYTHING_SORT_SIZE_DESCENDING);

	printf("Execute Query\n");
	Everything_QueryW(TRUE);

	printf("Result List Request Flags %08x\n",Everything_GetResultListRequestFlags());
	
	{
		DWORD i = 0;
		DWORD relt = Everything_GetNumResults();
		for(i=0;i<relt;i++)
		{
			LARGE_INTEGER size;
			const wchar_t *filename;
			const wchar_t *path;
			
			Everything_GetResultSize(i,&size);
			
			filename = Everything_GetResultFileNameW(i);
			path = Everything_GetResultPathW(i);
			
			printf("Name: %S\n",filename);
			printf("Path: %S\n",path);
			printf("Size: %I64u\n",size.QuadPart);
		}
	}


I don't know What is the error meaning?
void
Developer
Posts: 16665
Joined: Fri Oct 16, 2009 11:31 pm

Re: SDK:error code 3

Post by void »

Return Value is 3.
Was this the return value from Everything_GetLastError()? or GetLastError()?

After what call did you check Everything_GetLastError()?

Please try also calling GetLastError(), what is the last Windows Error?

Here's the SDK code that will cause error 3 (EVERYTHING_ERROR_REGISTERCLASSEX):

Code: Select all

	
if (!GetClassInfoEx(GetModuleHandle(0),TEXT("EVERYTHING_DLL"),&wcex))
{
	ZeroMemory(&wcex,sizeof(WNDCLASSEX));
	wcex.cbSize = sizeof(WNDCLASSEX);
	wcex.hInstance = GetModuleHandle(0);
	wcex.lpfnWndProc = _Everything_window_proc;
	wcex.lpszClassName = TEXT("EVERYTHING_DLL");
	
	if (!RegisterClassEx(&wcex))
	{
		_Everything_LastError = EVERYTHING_ERROR_REGISTERCLASSEX;
		
		return 0;
	}
}
The RegisterClassEx call failed. Reason unknown.
Usually RegisterClassEx will fail if the class is already registered. However, the call to GetClassInfoEx above checks for that condition.
Are you calling Everything_Query from multiple threads at the same time? -there might be a race condition here..
brindy
Posts: 7
Joined: Fri Nov 16, 2018 12:20 pm

Re: SDK:error code 3

Post by brindy »

Thank you.
I found the error.
But now, I have a new question.
How to show the request on my window in a real time just like Everything's window.

Code: Select all

	Everything_CleanUp();
	Everything_SetSearchW(searchthing.c_str());
	Everything_SetRequestFlags(EVERYTHING_REQUEST_FILE_NAME | EVERYTHING_REQUEST_PATH);
	Everything_SetSort(EVERYTHING_SORT_SIZE_DESCENDING);
	Everything_SetReplyWindow(GetHWND());
	brl = Everything_QueryW(false);
	
if I use the Everything_QueryW(true) , I can show the Request on my list in my window, but it's not a real time.
void
Developer
Posts: 16665
Joined: Fri Oct 16, 2009 11:31 pm

Re: SDK:error code 3

Post by void »

Please try setting a view window before executing your query.

As you have it now, Everything will be sending every single result via IPC which will take a few seconds.

To set a view window, please try:
// set the query offset to the current vertical scroll bar position of your result list.
Everything_SetOffset(GetVScrollPosition());

// set the maximum number of results that could be visible in your result list.
Everything_SetMax(GetMaxVisibleItems());

// execute the query.
Everything_QueryW(true);


---------


when you resize your result list, or change the vertical scroll position, don't forget to requery!
brindy
Posts: 7
Joined: Fri Nov 16, 2018 12:20 pm

Re: SDK:error code 3

Post by brindy »

void wrote: Thu Nov 22, 2018 8:14 am Please try setting a view window before executing your query.

As you have it now, Everything will be sending every single result via IPC which will take a few seconds.

To set a view window, please try:
// set the query offset to the current vertical scroll bar position of your result list.
Everything_SetOffset(GetVScrollPosition());

// set the maximum number of results that could be visible in your result list.
Everything_SetMax(GetMaxVisibleItems());

// execute the query.
Everything_QueryW(true);


---------


when you resize your result list, or change the vertical scroll position, don't forget to requery!
Thanks~!

I found the IPC to be used in my function.
I tried to show the icon of every file or function,but something worried.
I saw the EVERYTHING_IPC_FILTER_PICTURE , but I don't know how to used it.
void
Developer
Posts: 16665
Joined: Fri Oct 16, 2009 11:31 pm

Re: SDK:error code 3

Post by void »

The Everything SDK does not expose the file or folder icon cache in Everything.

It is up to the user to gather icons. Please see SHGetFileInfo for more information.

I may expose the Everything icon cache in a future Everything IPC release (early Everything 1.4 IPC had support for this and thumbnails).

EVERYTHING_IPC_FILTER_PICTURE is used in the IPC call EVERYTHING_IPC_GET_FILTER.
The call is sent to an open Everything search window.

Code: Select all

int filter = (int)SendMessage(FindWindow(EVERYTHING_IPC_SEARCH_CLIENT_WNDCLASS,0),EVERYTHING_WM_IPC,EVERYTHING_IPC_GET_FILTER,0); 
The return value in filter can be one of EVERYTHING_IPC_FILTER_* types.
brindy
Posts: 7
Joined: Fri Nov 16, 2018 12:20 pm

Re: SDK:error code 3

Post by brindy »

void wrote: Wed Nov 28, 2018 6:28 am The Everything SDK does not expose the file or folder icon cache in Everything.

It is up to the user to gather icons. Please see SHGetFileInfo for more information.

I may expose the Everything icon cache in a future Everything IPC release (early Everything 1.4 IPC had support for this and thumbnails).

EVERYTHING_IPC_FILTER_PICTURE is used in the IPC call EVERYTHING_IPC_GET_FILTER.
The call is sent to an open Everything search window.

Code: Select all

int filter = (int)SendMessage(FindWindow(EVERYTHING_IPC_SEARCH_CLIENT_WNDCLASS,0),EVERYTHING_WM_IPC,EVERYTHING_IPC_GET_FILTER,0); 
The return value in filter can be one of EVERYTHING_IPC_FILTER_* types.
Thanks~!
brindy
Posts: 7
Joined: Fri Nov 16, 2018 12:20 pm

Re: SDK:error code 3

Post by brindy »

void wrote: Wed Nov 28, 2018 6:28 am The Everything SDK does not expose the file or folder icon cache in Everything.


The return value in filter can be one of EVERYTHING_IPC_FILTER_* types.
I had use the ipc query to searching.
But the result can't set the sort -- EVERYTHING_IPC_SORT_EXTENSION_ASCENDING.
I found the EVERYTHING_IPC_COPYDATA_QUERY2W.
How to use it?
Just like the query1?

I try to write the code. But it doesn't work.
Send code:

Code: Select all

EVERYTHING_IPC_QUERY2 *query2;

	DWORD len;
	DWORD size;
	HWND everything_hwnd;
	COPYDATASTRUCT cds;

	everything_hwnd = FindWindow(EVERYTHING_IPC_WNDCLASS, 0);
	if (everything_hwnd)
	{
		len = (int)wcslen(search_string);
		size = sizeof(EVERYTHING_IPC_QUERY2) - sizeof(WCHAR) + len * sizeof(WCHAR) + sizeof(WCHAR);

		query2 = (EVERYTHING_IPC_QUERY2*)HeapAlloc(GetProcessHeap(), 0, size);
		if (query2)
		{
			query2->max_results = EVERYTHING_IPC_ALLRESULTS;
			query2->offset = 0;
			query2->reply_copydata_message = EVERYTHING_IPC_COPYDATA_QUERY2W;
			query2->reply_hwnd = (DWORD)hwnd;
			query2->search_flags = (regex ? EVERYTHING_IPC_REGEX : 0) | (match_case ? EVERYTHING_IPC_MATCHCASE : 0) | (match_whole_word ? EVERYTHING_IPC_MATCHWHOLEWORD : 0) | (match_path ? EVERYTHING_IPC_MATCHPATH : 0);
			query2->request_flags = EVERYTHING_IPC_QUERY2_REQUEST_FULL_PATH_AND_NAME;
			query2->sort_type = EVERYTHING_IPC_SORT_EXTENSION_ASCENDING;

			CopyMemory(query2->search_string, search_string, (len + 1) * sizeof(WCHAR));

				cds.cbData = size;
				cds.dwData = EVERYTHING_IPC_COPYDATAQUERY;
				cds.lpData = query2;
		}

			if (::SendMessage(everything_hwnd, WM_COPYDATA, (WPARAM)hwnd, (LPARAM)&cds) == TRUE)
			{
				HeapFree(GetProcessHeap(), 0, query2);

				return TRUE;
			}
			else
			{
				// Everything IPC service not running
			}
			HeapFree(GetProcessHeap(), 0, query2);
brindy
Posts: 7
Joined: Fri Nov 16, 2018 12:20 pm

Re: SDK:error code 3

Post by brindy »

Copy_Data code:

Code: Select all

	EVERYTHING_IPC_LIST2 *list2;
...
	case WM_COPYDATA:
	{
		COPYDATASTRUCT *cds = (COPYDATASTRUCT *)lParam;

		switch (cds->dwData)
		{
		case EVERYTHING_IPC_COPYDATA_QUERY2W:

			list2 = (EVERYTHING_IPC_LIST2*)cds->lpData;

			int sum = list2->numitems;
			if (sum > 40)
			{
				sum = 40;
			}

			for (i = 0; i<sum; i++)
			{

				IsChange = false;
				OldComplit = false;
				itemFlg = list2->items[i].flags;

				DisplayName(EVERYTHING_IPC_WM_QUERY_GET_RESULT_FULL_PATH_AND_NAMEW(list2,&list2->items[i]));

			}
something I changed in the ipc.h

Code: Select all

//in EVERYTHING_IPC_QUERY2    I net off the string
 TCHAR search_string[1];
 
 // For Using the reslut of full path and name I defined follow
 #define EVERYTHING_IPC_WM_QUERY_GET_RESULT_FULL_PATH_AND_NAMEW(list,item) (WCHAR*)((CHAR *)(list) + ((EVERYTHING_IPC_ITEM2 *)(item))->data_offset)
 
void
Developer
Posts: 16665
Joined: Fri Oct 16, 2009 11:31 pm

Re: SDK:error code 3

Post by void »

Please try running Everything in debug mode and check for any IPC call errors:
  • In Everything, type in the following search and press ENTER
    /debug
Perform an IPC call.
Everything should display some debug information about the call in Cyan color.

For example:
IPC: query complete: 4294967295 max results, offset 0, reply hwnd 17307874

To close the Everything debug console:
  • In Everything, type in the following search and press ENTER
    /debug
Please also consider looking at the command line interface source code as it uses the EVERYTHING_IPC_QUERY2 interface:
/support/everything/command_line_interface/

If you are modifying the EVERYTHING_IPC_QUERY2 struct, please make sure you allocate enough space to store the search after your EVERYTHING_IPC_QUERY2 struct.

If you have removed the TCHAR search_string[1]; part from the struct, you may need to change the following line:
size = sizeof(EVERYTHING_IPC_QUERY2) - sizeof(WCHAR) + len * sizeof(WCHAR) + sizeof(WCHAR);
to:
size = sizeof(EVERYTHING_IPC_QUERY2) + len * sizeof(WCHAR) + sizeof(WCHAR);

Copy your search to the end of this structure, for example:
EVERYTHING_IPC_QUERY2 myquery;
const wchar_t search_string=L"hello";
CopyMemory(myquery+1,search_string,(wcslen(search_string)+1) * sizeof(wchar_t));
brindy
Posts: 7
Joined: Fri Nov 16, 2018 12:20 pm

Re: SDK:error code 3

Post by brindy »

void wrote: Thu Nov 29, 2018 9:12 am Please try running Everything in debug mode and check for any IPC call errors:
  • In Everything, type in the following search and press ENTER
    /debug
Perform an IPC call.
Everything should display some debug information about the call in Cyan color.

For example:
IPC: query complete: 4294967295 max results, offset 0, reply hwnd 17307874
Thank you Very very much.
I've finish my function.
Post Reply