|
tasumisra wrote: so please tell me during interview what should i tell... about my work knowledge....
If you have to ask, then you don't know COM.
"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
|
|
|
|
|
Hi,
I use WinXP. I noticed that if we create bursh or pen object and destroy them, the GDI object count that is seen in the task manager is not decreasing.
What I did is,
I created 20 brushes in a button click. Then the GDI object count is increased from 28 to 48. Then destroyed the objects in another button click. Now the GDI object count is 38. But if click the first button again the count is getting increased to only 48, means the objects are already destroyed but the count is not updated correctly.
Why this behaviour?
The code sample:
HGDIOBJ hBr[20];<br />
void CMyDlg::OnButtonCreate() <br />
{<br />
for( int i = 0; i < 20; i++ ) hBr[i] = CreateSolidBrush( 0 );<br />
}<br />
<br />
void CMyDlg::OnButtonDestroy() <br />
{<br />
for( int i = 0; i < 20; i++ ) DeleteObject( hBr[i] );<br />
}<br />
I tried it for pen objects, then the result is 28 to 48 on creation and 48 to 36 on destruction. But the 48 is stable for each creation similar to the brush, if the destruction is done for each creation.
But for font objects it is working fine. That is 28 to 48 on creation and 48 to 28 on destruction.
- NS -
|
|
|
|
|
Where GDI object count is displayed in the task manager? I have not seen before
|
|
|
|
|
Please use menu to enable that. View > Select Columns...
- NS -
|
|
|
|
|
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.
|
|
|
|