|
HFILE hFile = OpenFile( szPath , ofStruct , OF_READWRITE )
how to close this hFile pointer ?
thanks
|
|
|
|
|
It clearly mentioned in documentation, this API is for compatibility with 16bit OS.
Use CreateFile instead.
And CloseHandle to close it.
Prasad
MS MVP - VC++
|
|
|
|
|
i alswo want to test OF_EXIST
HFILE hFile = OpenFile( szPath , ofStruct , OF_EXIST )
and
ofStruct.fFixedDisk
so i dont want to use CreateFile.
|
|
|
|
|
Check value return of this file (hFile).
|
|
|
|
|
Hi,
Can we change the size of the default scrollbar for a particular window (control) only?
For example, I need to change the default scrollbar size of the edit box leaving all other controls' scrollbars unchanged.
Size means width of the vertical scrollbar and height of the horizontal scrollbar.
Thanks in advance.
- NS -
|
|
|
|
|
|
Thanks.
I already had look at this article. But it is just for listbox. It is done by hiding the default and place a new one.
Actually i need to change the default scrollbar size.
- NS -
|
|
|
|
|
Dear All,
Good day. I have problem with the code below (which I used to get the directory path in the address bar of explorer.exe):
<small>
TCHAR lpString[1024] = _T("");
if ((strcmp(c, "ExploreWClass") == 0) || strcmp(c, "CabinetWClass") == 0) {
HWND hWorker, hReBar32, hCombo32, hCombo, hEdit;
hWorker = FindWindowEx(hwnd, 0, "WorkerW", NULL);
if (hWorker) {
hReBar32 = FindWindowEx(hWorker, 0, "ReBarWindow32", NULL);
if (hReBar32) {
hCombo32 = FindWindowEx(hReBar32, 0, "ComboBoxEx32", NULL);
if (hCombo32) {
hCombo = FindWindowEx(hCombo32, 0, "ComboBox", NULL);
if (hCombo) {
hEdit = FindWindowEx(hCombo, 0, "Edit", NULL);
if (hEdit) {
SendMessage(hEdit, WM_GETTEXT, 1024, (LPARAM)(void*)lpString);
}
}
}
}
}
}
</small>
I believed due to Vista Architecture different from 2K and XP, this code doesn't work anymore and it always fail at FindWindowEx(hReBar32, 0, "ComboBoxEx32", NULL); in Vista. Anybody can give me some instructions on how to make this work with Vista?
|
|
|
|
|
Hirakawa wrote: it always fail at FindWindowEx(hReBar32, 0, "ComboBoxEx32", NULL); in Vista
What does GetLastError returns ?
Prasad
MS MVP - VC++
|
|
|
|
|
Hi Prasad_Som
Thank you for reply. I use the following codes to get the last error and I got dword value 0.
DWORD dwResult = GetLastError();
CString Temporary;
Temporary.Format("%d", dwResult);
AfxMessageBox(Temporary);
|
|
|
|
|
Hirakawa wrote: I got dword value 0.
It indicates sucess but you need to use this code after failed API .
hCombo = FindWindowEx(hCombo32, 0, "ComboBox", NULL);
LPVOID lpMsgBuf;
FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
GetLastError(),
0,
(LPTSTR) &lpMsgBuf,
0,
NULL
);
MessageBox( NULL, (LPCTSTR)lpMsgBuf, "Error", MB_OK | MB_ICONINFORMATION );
LocalFree( lpMsgBuf );
Prasad
MS MVP - VC++
|
|
|
|
|
Hi Prasad,
Thank you. I got a string "The operation completed successfully" when running your code but I still fail at hCombo32 = FindWindowEx(hReBar32, 0, "ComboBoxEx32", NULL);
Best regards,
|
|
|
|
|
Suggesting to post this query in Vista forum.
It can be best answered there. As users having exposure to vista will visit there.
Prasad
MS MVP - VC++
|
|
|
|
|
Hirakawa wrote: FindWindowEx(hReBar32, 0, "ComboBoxEx32", NULL);
in the vista when I checked the ComboBoxEx32 is not directly under the "ReBarWindow32".There is a window in between. the class name is "Address Band Root". So you have to first find "Address Band Root" window under the ReBarWindow32 and then the ComboBoxEx32 from it.
|
|
|
|
|
Hi Nave,
Thank you for reply. I tried to use the FindWindowEx to find the "Address Band Root". Good news is it really exist but the problem still with FindWindowEx(hReBar32, 0, "ComboBoxEx32", NULL);
By the way, can you teach me what method do you use to find out or learn about the existing of "Address Band Root"?
|
|
|
|
|
So why not just use Spy++ to see if the parent/child windows have the same relationship on the two platforms?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Thank you to everyone who replied. I found the answer:
I need to find "Address Band Root" and "msctls_progress32" before "ComboBoxEx32"
|
|
|
|
|
I'm trying to make a program like Texas Calculatem, www.calculatem.com,
where it will read my hole cards and the cards on the board, then tell
me my odds!
I can't figure out how I would have the program read what cards are in
my hand or on the board. Any help would be appreciated, Thanks!
|
|
|
|
|
If you draw each card as a Graphics GDI+ object you can find them easier.
|
|
|
|
|
In my Dialog Based MFC application i have a menu, one of the items should be disabled and grey upon startup (Maybe i can use the "Grayed" checkbox on the settings for the item?), then a few moments later, usable. Ive searched around alot, yet not find exactly what i want or something 100% working. So far i have created the UPDATE_COMMAND_UI function for the menu item, and put pCmdUI->Enable(false); into it. So now when i click it nothing happens. (its not grey though) So how do i grey it out?
thanks!
//Johannes
|
|
|
|
|
1. Make the controls disabled in the dialog template
2. In OnInitDialog() , set a timer
3. In OnTimer() , enable the controls.
|
|
|
|
|
Some of the command routing for like menus is not hooked up from CDialog. You can hook it up yourself somehow... I forget... search on MSDN (Using Google if I were you) to find some really really old articles or technical notes about this that show you how to solve the problem.
|
|
|
|
|
There's also CWnd::UpdateDialogControls() which allows the use of ON_UPDATE_COMMAND_UI in dialogs.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Ive looked at UpdateDialogControls() and it seems to be connected with UPDATE_COMMAND_UI. Ive searched around alot, on iGoogle, MSDN and codeproject yet not found something simple and working..
Another thing i dont understand is that UPDATE_COMMAND_UI seems to be executed when the menu item is clicked? but it cant really be clicked if it is disabled... Why cant it be as easy as to enable/disable the other dialog controls....
Thanks for the help
//Johannes
|
|
|
|
|
Hi all,
I'm trying to write an app like a LAN Messenger using MailSlots, everything works fine (almost), i just can't detect when the mailslot server doesn't exists. And i don't figure how i can do it .
I'm writing to the mailslot using a CreateFile statement like the ones in this wonderful site ... but nothing bad happens when the mailslot is closed.
Someone knows how i can realize this trick????
Any suggestion is welcome, Thank you in advance
|
|
|
|