|
Can you explain the code for me in detail? I mean word by word.
Thank you.
Best regard.
I confess that I am a stubborn guy, but why not put things thoroughly, logically and systematically clean. One concrete prolem is worth a thousand unapplied abstractions.
|
|
|
|
|
NicholasCougar wrote:
Can you explain the code for me in detail? I mean word by word.
There is no need to explain it more than to say that they cast a pointer to a member function into another type of function pointer.
But to spell it out, I think it's spelled something like:
Emm eff see sucks, partially because Microsoft lagged ~5 years behind the competing C++ implementation, and partially since the AFX (remember, it was Application Framework eXperimental - probably with emphasis on the experimental part) group wasn't too good at neither design nor C++.
Sure, using the inferior MS compiler they actually managed to make something work, sometimes... But the price we got to pay for this was un-typesafety that has wasted several hundred of thousands of developer hours around the globe to date.
|
|
|
|
|
can anybody tell me how to register a com dll with c++ code? better give me some piece of code, thanks!;P
Richy
Richy
|
|
|
|
|
You can simply call the DllRegisterServer function that is exported from the COM DLL. That is what regsvr32 does.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
I'm trying to use a CPropertySheet as a child window to a dialog... It all works pretty ok exept for one small and extremely annoying bug:
If a child window of a CPropertyPage has the input focus when the main window loses focus (for instance if Alt+Tab is pressed or if another top-level window is activated) the application stops responding.
Has anyone experienced this problem before?
If yes do you know of a solution or workaround?
Demo project available for download here.
Cheers!
Marc
|
|
|
|
|
A curious problem indeed! The problem is, you are not telling the property sheet it is to be used as a control. You can do this by creating it with the WS_EX_CONTROLPARENT style. So this line:
m_wndSheet.Create(this,WS_VISIBLE|WS_CHILD);
Needs to be changed to:
m_wndSheet.Create(this,WS_VISIBLE|WS_CHILD,WS_EX_CONTROLPARENT);
--------
I don't think that I'm a sell-out but I do "Enjoy Coke!"... -- Bloodhound Gang, The Inevitable Return Of The Great White Dope
|
|
|
|
|
Actually, I've found that calling Create like that doesn't work with regards to the window processing keyboard input correctly. For example, copying and pasting your code resulted in the Esc key not working and Tab key not moving from the pages to the other controls on the parent dialog. Therefore, I create sheets within a dialog like this:
m_sheet.Create(this, WS_CHILD | WS_VISIBLE);
m_sheet.ModifyStyleEx (0, WS_EX_CONTROLPARENT);
Cheers,
Tom Archer
Author - Inside C#, Visual C++.NET Bible
|
|
|
|
|
Thank You! This has been bothering me for a long time, i never would have guessed simply using ModifyStyleEx() would fix it.
--------
I don't think that I'm a sell-out but I do "Enjoy Coke!"... -- Bloodhound Gang, The Inevitable Return Of The Great White Dope
|
|
|
|
|
|
Cool! Thanks a lot.. I'd probably never have figured that out myself =)
Cheers!
Marc
|
|
|
|
|
Call it serendipity. I swear I was literally doing A/R (author review) on a property pages/sheets chapter for my MFC book when I saw the question. I glanced at it and then looked at my code - no kidding, one demo is putting a prop page in a dialog! - and noticed the different technique.
I took my code out and tried the other and saw the tab and esc problem. I put mine back in and it worked. You must be living right
Cheers,
Tom Archer
Author - Inside C#, Visual C++.NET Bible
|
|
|
|
|
I have one question.Sorry, may be this could be posted multiple times.
How can i differentiate between shutdown and restart in Win32 based app.With the help of WM_QUERYENDSESSION from lparam i could differentiate between Logoff and shutdown/restart but couldnot differentiate between Shutdown and restart.Can you pls.give me your ideas.
Thanks
-surender
|
|
|
|
|
Not too long ago I came across an article on windows registry settings somewhere through google. (Sorry no link. Its been a couple (few?) weeks ago).
I remember seeing a registry setting set by windows on shutdown indicating what kind of shutdown it was performing. I may be wrong. You could use RegMon from www.sysinternals.com to watch the registry and see what this value is and then query it in your app.
Hope this helps.
|
|
|
|
|
I need somehow to get a list of NT user names. I get current user name with GetUserName but I need names of all existing profiles.
Thanks a lot.
|
|
|
|
|
I think you need to make up your mind:
Either you want to know the name of the existing "profiles", or you want a list of user names in the domain (or in case of a single machine, on the workstation). For the latter you use NetUserEnum.
If you however only want a list of the "profiles" in the "Profiles" directory, you just use FindFirstFile & co.
|
|
|
|
|
Well. I need that list that you see in "Control panel"->"Users and passwords"->"Users for this computer".
But thank you any way! I was looking for something like NetUserEnum in MSDN for a week now.
|
|
|
|
|
Hey guys
I have soem code that flushes the file buffer if a file was opened using GENERIC_WRITE and then closes the handle. The problem is these functions return an error but when i check them it says error successful any idea whats going wrong heres my code.
if(hFileHandle != NULL)
{
if(dwAccessModeSetting == GENERIC_WRITE)
{
if(FlushFileBuffers(hFileHandle) == 0)
{
AfxMessageBox("Flush File Buffer Failed"); //Debug
DWORD dwLastError = GetLastError();
ResolveError(dwLastError);
}
}
if(CloseHandle(hFileHandle) == 0)
{
AfxMessageBox("Close Handle Failed on File Access Destruct"); //Debug
DWORD dwLastError = GetLastError();
ResolveError(dwLastError);
}
}
|
|
|
|
|
Recover the error before anything else --before the call to AfxMessageBox in your case.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I would like to show graphics at a fixed 30 fps.
The only solution I have is:
while (true) {
while (not ready) {
check the performance timer()
}
draw()
}
The problem is that this method pegs the cpu.
I would like to use one of these:
- SetTimer and handle WM_TIMER
- use WaitForSingleObject with a WaitableTimer possibly
but they have too low a resolution.
Can anyone see another solution?
Thanks,
Alex Griffing
|
|
|
|
|
Use timeGettime and draw in your idle time if the right amount of time has passed. This solution will work if your system is too slow to do 30 fps and can be set so things still move at the same speed, albiet not as smoothly, and can clamp the top speed to 30 fps.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
And you don't spend much time with the opposite sex working day and night, unless the pizza delivery person happens to be young, cute, single and female. I can assure you, I've consumed more than a programmer's allotment of pizza, and these conditions have never aligned. - Christopher Duncan - 18/04/2002
|
|
|
|
|
Multimedia timers could be called for here. Check Nemanja Trifunovic's Timers tutorial. The minimum resolution attainable with these timers depends on the OS [and the hardware it is running on], but probably it is decent for your needs.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Who's the developer at MS that created the Find in Files GUI in VS7? That has to be one of the worse GUI's ever! The Look In dialog is overly cumbersome.
Todd Smith
|
|
|
|
|
That damn dialog where you select the folders to search is in such a pain. And then they don't even save previous search folders
Cheers,
Tom Archer
Author - Inside C#, Visual C++.NET Bible
A total abstainer is one who abstains from everything but abstention, and especially from inactivity in the af
|
|
|
|
|
NO KIDDING!!!!
That thing is total crap. Hard to use. I hate it.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
Hi,
I have the below function to retrieve the applications that are running.
The only problem is that it doesnt retrieve the applciation name, but the
name on top of the window.
Is there any way I can just return the name of the application?
Instead of returning 'Inbox - Microsoft Outlook', but getting it to return
'Microsoft Outlook'
static BOOL CALLBACK AddWinsList(HWND hWnd, LPARAM lParam);
BOOL CALLBACK AddWinsList(HWND hWnd, LPARAM lParam)
{
if (!IsWindowVisible(hWnd) || GetWindow(hWnd, GW_OWNER) != NULL)
return TRUE;
TCHAR szClassName[80];
GetClassName(hWnd, szClassName, 80);
if (lstrcmpi(szClassName, _T("Progman")) == 0)
return TRUE;
char szWndText[556];
GetWindowText(hWnd, szWndText, 556);
if (strlen(szWndText) > 0) AfxMessageBox(szWndText);//Displays name
return TRUE;
}
// do callback
EnumWindows((WNDENUMPROC)AddWinsList, (LPARAM)0);
Thanks
neil
|
|
|
|