|
The best way to find out what messages are coming to your window (and in what order) is to run Spy++ on the application.
Michael
Programming is great. First they pay you to introduce bugs into software. Then they pay you to remove them again.
|
|
|
|
|
IIRC the first message any window get is WM_GETMINMAXINFO (or is it NC_CALCSIZE?).
Perhaps you should add some printf-debugging to your dialog main procedure and check for yourself?
|
|
|
|
|
The fact that you're asking the question suggests a problem with your design.
It is unwise to rely on any message order (except WM_NCDESTROY). The order of messages may vary from one OS to another or when other circumstances change.
As other posters have said it shouldn't be difficult to find out which message arrives first after WM_INITDIALOG but you should not depend on it always being the same.
Regards,
Phil
|
|
|
|
|
Is there an api that I can use to check if the current user is administrator.
Thank you
Orcun Colak
|
|
|
|
|
There's recently documented APi called 'IsAdmin' - check online MSDN. There's also KB article Q118626 which has similiar function.
Tomasz Sowinski -- http://www.shooltz.com
** Putt knot yore thrust inn spel chequers. **
|
|
|
|
|
The alleged IsUserAnAdmin() API doesn't exist in shell32.dll like MS claims. Use Depends and see for yourself. Weird.
--Mike--
Just released - RightClick-Encrypt v1.4 - Adds fast & easy file encryption to Explorer
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
Michael Dunn wrote:
Use Depends and see for yourself. Weird
Yeah, you're right. Maybe it's one of functions exported by ordinal??
Tomasz Sowinski -- http://www.shooltz.com
** Putt knot yore thrust inn spel chequers. **
|
|
|
|
|
Sam Blackburn's Win32 Foundation Classes (WFC) [^] provide a function called wfc_am_i_administrator that serves this purpose.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
orcun colak wrote:
Is there an api that I can use to check if the current user is administrator.
No. You have to do it manually. Search for SID in MSDN.
|
|
|
|
|
I've tried using a CStatic control in my CView derived class to animate a bitmap. I use 4 separate bitmaps but after a couple of minutes (variable) it fails and I get an error related to CBitmap. This also messes up all of Windows graphically. So, after playing around with it, I decided to give up on CBitmap and CStatic. FYI, here is what I had:
MyViewClass::OnTimer(UINT nIDEvent)
{
if(nIDEvent == m_AnimTimerId)
{
if(BmpId == IDB_ASTLEFT + 4)
BmpId = IDB_ASTLEFT;
CStatic *pTargetCtrl = (CStatic *) GetDlgItem(IDC_ERR_STATIC);
ASSERT(pTargetCtrl != NULL);
m_CurrentBmp.Detach();
m_CurrentBmp.LoadBitmap(BmpId);
pTargetCtrl->SetBitmap(m_CurrentBmp);
BmpId++;
}
}
So, I decided to use memory DCs and blt it onto the screen. However, I am not sure I am obtaining the DC correctly since I get an error in the bitblt routine now used in the timer routine.
void CStatsView::InitialDraw()
{
pTheDC = GetDC();
CBitmap bmp1, bmp2, bmp3, bmp4;
bmp1.LoadBitmap(IDB_ASTLEFT);
bmp2.LoadBitmap(IDB_ASTLEFT+1);
bmp3.LoadBitmap(IDB_ASTLEFT+2);
bmp4.LoadBitmap(IDB_ASTLEFT+4);
dcMem1.CreateCompatibleDC(pTheDC);
dcMem2.CreateCompatibleDC(pTheDC);
dcMem3.CreateCompatibleDC(pTheDC);
dcMem4.CreateCompatibleDC(pTheDC);
dcMem1.SelectObject(&bmp1);
dcMem2.SelectObject(&bmp2);
dcMem3.SelectObject(&bmp3);
dcMem4.SelectObject(&bmp4);
}
The OnTimer code now looks like this:
if(BmpId == IDB_ASTLEFT + 4)
BmpId = IDB_ASTLEFT;
switch(BmpId)
{
case IDB_ASTLEFT :
pTheDC->BitBlt(0, 0, 7, 7, &dcMem1, 0, 0, SRCCOPY);
break;
case IDB_ASTLEFT + 1 :
pTheDC->BitBlt(0, 0, 7, 7, &dcMem2, 0, 0, SRCCOPY);
break;
case IDB_ASTLEFT + 2 :
pTheDC->BitBlt(0, 0, 7, 7, &dcMem3, 0, 0, SRCCOPY);
break;
case IDB_ASTLEFT + 3 :
pTheDC->BitBlt(0, 0, 7, 7, &dcMem4, 0, 0, SRCCOPY);
break;
}
BmpId++;
If that is the case, where in my view should I obtain a pointer to the DC?
|
|
|
|
|
JohnnyG wrote:
If that is the case, where in my view should I obtain a pointer to the DC?
Use CClientDC, which encapsulates calls to GetDC/ReleaseDC. You should also use CClientDC in InitialDraw.
Tomasz Sowinski -- http://www.shooltz.com
** Putt knot yore thrust inn spel chequers. **
|
|
|
|
|
|
I cannot get my progress bar to show on the status bar. The only way I found around it to show is to use MyPBar.SetWindowPos(...). Doing it this way, though, mispositions the progress bar on different computers. How do I lock it to my status bar? Here's what I have:
In MainFrm.cpp:
CRect rect;
m_wndStatusBar.GetItemRect(2, &rect);
m_ProgBar.Create(WS_VISIBLE | WS_CHILD | PBS_SMOOTH,
rect, this, ID_INDICATOR_PBAR);
m_ProgBar.SetRange(0,100);//Set the range to between 0 and 100
m_ProgBar.SetStep(1);//Set the step amount
//the line below is brute force, can't find out how to display ProgBar
m_ProgBar.SetWindowPos(NULL,782,714,105,16,NULL);
In CView.cpp (or elsewhere):
.
.
.
CMainFrame* pFrame = (CMainFrame*)AfxGetApp()->m_pMainWnd;//pointer to mainframe object
.
.
.
pFrame->m_ProgBar.StepIt();//never shows on status bar
Any suggestions? Thx
ralf.riedel@usm.edu
|
|
|
|
|
You should make progress control a child of status bar, not main frame. Check Q142202 for details.
Tomasz Sowinski -- http://www.shooltz.com
** Putt knot yore thrust inn spel chequers. **
|
|
|
|
|
Q142202? Could not find that article.
ralf.riedel@usm.edu
|
|
|
|
|
|
|
Hello there,
How can i change windows background ?
Is there any API function for it ?
Please help me ...
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
you can overwrite PreCreateWindow function.
|
|
|
|
|
I wanna change background of Windows OS !!!
Not dialogs ...
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
try IActiveDesktop::SetWallpaper
modified 12-Sep-18 21:01pm.
|
|
|
|
|
|
Hello Jason !!!
That's it !!!!!
Now, it wroks fine
Thanks in advance
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
Hi there,
I’m looking for a way for inserting a dialog to another …
For example, I have Dialog1(parent) then I make new dialog(child) and then I insert a textbox in the second dialog (Dialog2) …
Is there anyway to attach the Dialog2(child) to Dialog1(parent) ???
I want to when I show the parent wndow(dialog1) by .DoModal() then I be able to see dialog2 in dialog1 !!!
How ???
If possible please write sample
Thanks in advance.
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|