|
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
|
|
|
|
|
|
Hello dear Chris Losinger
Thanks aloot for example
With Warm Regards
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
The following code works with DAO 3.5, but it doesn't when I add the following line into InitInstance():
<br />
AfxGetModuleState()->m_dwVersion = 0x0601;<br />
....<br />
<br />
CDaoDatabase db;<br />
db.Create("c:\\test.mdb");<br />
<br />
CDaoTableDef td(&db);<br />
<br />
td.Create("test link");<br />
td.SetConnect("dBase IV;Database=C:\\");<br />
<br />
td.SetSourceTableName("test.ddf");<br />
<br />
td.Append();<br />
The error message is "The Microsoft Jet database engine could not find the object 'test'. Make sure the object exists and that you spell its name and the path name correctly."
I've tried using "test#ddf" as a vaguely remember reading that this is the key to getting non standard extensions accepted, but this makes no difference in Jet 3.5 or 3.6 (i.e. 3.5 still works , 3.6 doesn't work
Any ideas?
|
|
|
|
|
MFC 6.0 has the ability to use Microsoft Access 2000 databases. To engage this support in your application you use.
AfxGetModuleState()->m_dwVersion = 0x0601;
So to use under DAO 3.5 just remove the line
Hmm...
|
|
|
|
|
but the whole point is that I want to use DAO 3.6
|
|
|
|
|
Hi all...
I've got a problem that arose after moving the resources in our application to an external resource dll for localization. All that works fine, but now the ClassWizard is basically unusable for adding new members based on controls in the dialogs. I know it's got something to do with the fact that all the control and dialog definitions are not part of my main app's project anymore... but..
does anyone know how to fix this?
Thanks in advance,
Andrew Welch
|
|
|
|
|
I don't know how to fix this ClassWizard issue. Any chance for storing main language resources (probably English) in .exe - this solves the problem completely. In this scenario, satellite dlls are needed only for secondary languages.
Tomasz Sowinski -- http://www.shooltz.com
** Putt knot yore thrust inn spel chequers. **
|
|
|
|
|
I think that is part of the solution.. However, we have separate english, italian, german, spanish and french dll's. Keeping the english resources embedded in the app really isn't feasible because we have some pretty big resources. Keeping them separate reduces the size of the install by about half.
I'm going to try something in the app's resource file (which is basically empty and static now ) using
#ifdef APSTUDIO_INVOKED
#endif
and see if I can't get the symbols I need loaded when editing only.
Thanks
|
|
|
|
|
Hi All,
I need to create a timer that would start once I start running a process from within my program.I need to know how much time it takes for the process to create the first output.For this I would need a timer.I case the timer value reaches a specified limit the process should be terminated.
What is the method I can do this.
Can anybody help me?
Thanks and regards,
Abhishek.
Learning is a never ending process of Life.
|
|
|
|