I see. I'm using Win32. Is there a workaround for this?
georgiek50
Posts
-
SendMessage to another dialog window -
SendMessage to another dialog windowThanks for the reply. I'm quite new at coding and can't quite decipher what you provided, but are you suggesting I subclass the control?
-
SendMessage to another dialog windowI'm having a problem sending a message from one window to another in my (Win32) application. A little background: 1) It's a dialog based app 2) It consists of a tab control and several child window dialogs I want to send the text of an edit control from one tab/child window to another tab/child window's list box using: SendMessage(hwnd, LB_ADDSTRING, 0, (LPARAM) szString); However I can not get them to communicate. I can't figure this out (never attempted it before). I have a single function handling all messages of each child window of the tab control. Everything works great as long as I'm updating the window/tab in view. Can anyone point me in the right direction? Thanks in advance.
-
Stuck w/ a simple ReadFile?!!!That was the problem. Thanks.
-
24 bit DIB has different values on PPC and Desktop PC?I recently ran into the situation where a bitmap displayed different results for pixels (255, 0, 255 vs. 248, 0, 248) on a desktop PC and a pocket PC. I've looked around for comments on this but haven't found anything. Does anyone have any information as to how this is possible????
-
Stuck w/ a simple ReadFile?!!!I thought I would post this here because I can't spot the error. This is my first attempt to code for a Pocket PC. The following code works fine on the desktop:
TCHAR szFilePath[MAX_PATH]; wsprintf(szFilePath, TEXT("%sTest.txt"), this->szAppRootDirectory); HANDLE hFile = CreateFile(szFilePath, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if ( hFile == INVALID_HANDLE_VALUE ) { MessageBox(hwnd, TEXT("Fatal error: Unable to open file."), NULL, MB_OK); return R_ERROR; } DWORD dwBytesRead; DWORD dwFileSize = SetFilePointer(hFile, 0, NULL, FILE_END); TCHAR *szBuffer = new TCHAR[dwFileSize + 1]; SetFilePointer(hFile, 0, NULL, FILE_BEGIN); ReadFile(hFile, szBuffer, dwFileSize, &dwBytesRead, NULL); CloseHandle(hFile); szBuffer[dwFileSize] = '\0';
Unfortunatelly, szBuffer fills w/ garbage (boxes) on the Pocket PC. Can anyone spot the error here? Thanks in advance. -
ShowHTMLDialog working with XP not Win98CreateURLMoniker returns S_OK. The only reason I know that it is failing at the specific line is that the HRESULT returned by ShowHTMLDialog != S_OK (I have tested all other return values). I guess the most important question from here is to find what error code exactly the function returns. That is what I can't find documentation on. Thanks for the help.
-
ShowHTMLDialog working with XP not Win98GetLastError() returns 0 and I don't know specifically which function to call to get this type of error (I'm very new to this stuff and can't find it in MSDN) Not working means the dialog isn't opening. The file is there, MSHTML.dll is being loaded as well. Thanks for the help.
-
ShowHTMLDialog working with XP not Win98I have a small function in my app that displays an HTML dialog that works find in Windows XP but not 98. Code is as follows:
void ShowExportTemplatePreview(HWND hwnd) { // Function to show a template export preview in another dialog window HINSTANCE hinstMSHTML = LoadLibrary(TEXT("MSHTML.DLL")); if(hinstMSHTML) { SHOWHTMLDIALOGFN *pfnShowHTMLDialog; pfnShowHTMLDialog = (SHOWHTMLDIALOGFN*) GetProcAddress(hinstMSHTML, TEXT("ShowHTMLDialog")); if(pfnShowHTMLDialog) { char szTemplatePreview[MAX_PATH]; wsprintf(szTemplatePreview, "%s\\Temp_0.html", cStartupData.szAppDirectory); WCHAR wcTemplatePreview[MAX_PATH]; MultiByteToWideChar(CP_THREAD_ACP, NULL, szTemplatePreview, sizeof(szTemplatePreview), wcTemplatePreview, MAX_PATH); IMoniker *pURLMoniker; CreateURLMoniker(NULL, wcTemplatePreview, &pURLMoniker); if (pURLMoniker) { BSTR bstrOptions = SysAllocString(L"dialogHeight:30;dialogWidth:45;resizable:yes"); (*pfnShowHTMLDialog)(hwnd, pURLMoniker, NULL, (char*) bstrOptions, NULL); SysFreeString(bstrOptions); pURLMoniker->Release(); } } FreeLibrary(hinstMSHTML); } }
This is mostly copied from MSDN and I am trying to find compatibility issues with no success. We have pinpointed the problem to: (*pfnShowHTMLDialog)(hwnd, pURLMoniker, NULL, (char*) bstrOptions, NULL); But i have no idea as to what is causing the error or how to even go about solving it. Does anyone have any experience with this function that could be of help? Thanks in advance. -
Help w/ Debugging pleaseThat's the problem...the dialog pops up and then when I hit cancel it takes me to the funny looking assembly code (or whatever it may be)
-
Help w/ Debugging pleaseI am trying to debug my app in MS Visual C++ 6.0 and when I come to an unhandled expression I get a dialog that pops up that says: Please enter the path to STRLEN.ASM...all I need to know is which statement is causing the error. Any suggestions?
-
Proper function declaration to avoid a memory leakYep, I was overwriting...thanks for pointing out my stupid mistakes ;P
-
Proper function declaration to avoid a memory leakExactly: DAMAGE: after normal block (#3604) at (memory address)
-
Proper function declaration to avoid a memory leakI have a function which returns a char* and I am trying to avoid a memory leak. So far it is in this format: char* MyFunction(char *szBuffer) { char *szTmpBuffer = new char[strlen(szBuffer) + 1]; ...function body... return szTmpBuffer; } And it is called somewhat like this: char *szBuffer = MyFunction(szString); but if after I use szBuffer I try to delete it: delete [] szBuffer; I get a Debug Assertion failed...so the question is, what is the proper way to call new within a function then delete the pointer outside of the function w/o causing errors and avoiding memory leaks?
-
Simple file I/O is giving me troubleThanks for the replies...yes the file is being opened as text...there shouldn't be a premature EOF character in there...but in general, what are my options while keeping this file open as text?
-
Simple file I/O is giving me troubleI am trying to read the entire content of a text file with the following code:
File.seekg(0, ios::end); long lFileSize = File.tellg(); szFileBuffer = new char[lFileSize + 1]; if ( szFileBuffer == NULL ) { MessageBox(NULL, "There is not enough memory to run this application", NULL, MB_ICONERROR | MB_OK); return 1; } File.seekg(0, ios::beg); File.get(szFileBuffer, lFileSize + 1, EOF); File.close();
The actual filesize is 715KB but the program is only reading 540KB...tellg gives the correct filesize yet get seems to only be getting 540KB...are there any workarounds for this...in general, are there buffer size limitations as far as istream::get is concerned? -
Need help w/ a simple recursive functionI'm such an idiot!!! It would help if FindClose cam before RemoveDirectory!!!!!
-
Need help w/ a simple recursive functionI wrote a function a while back to clean out a directory and all of its contents and tried re-writing the same one tonight but can't seem to get it right. Any chance someone can point out my mistake?
short ClearEntireDirectory(char *szDirectory) { // Function to work on a directory until everything is wiped out HANDLE hFile; WIN32_FIND_DATA wfd; if ( SetCurrentDirectory(szDirectory) == 0 ) return 1; hFile = FindFirstFile("*.*", &wfd); while ( FindNextFile(hFile, &wfd) != 0 ) { if ( wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY && strcmp(wfd.cFileName, "..") != 0 && strcmp(wfd.cFileName, ".") != 0 ) { if ( ClearEntireDirectory(wfd.cFileName) == 1 ) return 1; } DeleteFile(wfd.cFileName); } if ( SetCurrentDirectory("..") == 0 ) return 1; if ( RemoveDirectory(szDirectory) == 0 ) return 1; FindClose(hFile); return 0; }
I keep getting error 32 (ERROR_SHARING_VIOLATION) when I try to ultimatelly remove the directory. -
Fastest way to read entire file into memoryYep, that's exactly what I did, just making sure it's the fastest way. Thanks for the help.
-
Avoiding a memory leakhmmm, I just realized that ommitting the brackets only delets the first element...I have a lot of search/replacing to do!!!! Thanks for the help