|
Is there a way to capture what has failed inside 'PageSetupDlg' windows function. This function fails after the user has hit print. His computer rebots.
Rob
|
|
|
|
|
Hi Kruis,
Did you customize the Dialog Box? If so, and building a statically linked EXE, the proper #defines are not included as a resource. In that case, you must switch to a dynamically linked EXE.
Jeff
|
|
|
|
|
Hi Jeff,
Thanks for the reply, this is the basic code that I am using to setup the dialog.
LPPAGESETUPDLG pgs;
// Get memory for the page setup dialog structure
pgs = (LPPAGESETUPDLG) calloc ( 1, sizeof (PAGESETUPDLG ) );
if ( pgs == NULL )
goto exit_func;
pgs->lStructSize = sizeof (PAGESETUPDLG);
pgs->hwndOwner = hwndOwner;
pgs->hDevNames = hdevnames;
pgs->hDevMode = hdevmodes;
pgs->Flags = PSD_DISABLEMARGINS;
// Display the dialog to the user
retval = PageSetupDlg ( pgs );
|
|
|
|
|
I need to take the analog output of a scanner radio (dicriminator tapped, so there should be no noise), read it into the computer, and convert to digital. My thinking is that I should be able to do this through software using the soundboard instead of using a seperate A/D converter into a serial port or other port.
Anybody have any experience at doing this, or any advice, as I have never tried anything like this project before?
Thanx,
Rick
|
|
|
|
|
Microphone?
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
Hello friends,
what are the advantages of having virtual constructors and virtual destructors?
How they are called and what is the procedure of execution of them?
Thank you,
Neelesh K J Jain.
|
|
|
|
|
virtual destructor is an essential part of object-oriented paradigm. In inheritance, the virtual destructure allows the OS to delete the right object.
class a
{
public:
...
virtual ~a();
};
class b : public a
{
public:
...
virtual ~b();
};
b *pB = new b;
a *pA = dynamic_cast(pB);
// What get destroyed?
delete pA;
Kuphryn
|
|
|
|
|
Technically there is no such thing as a virtual constructor in C++. There are design patterns in the category of "creation patterns" that can be used to produce the virtual constructor idiom.
For an explanation of virtual destructors and many other things, read Scott Meyers Effective C++
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
Hai all,
I still could'nt find the solution. I'm using win32 vc++ and subclass for drawing my button bagkground. ie.
BOOL CALLBACK DialogProc (HWND hDialog, UINT message, WPARAM wParam,
LPARAM lParam)
{
switch (message)
{
case WM_INITDIALOG:
{
lpfnOldWndProc1 = (WNDPROC)SetWindowLong( GetDlgItem (hDialog,IDSTART ) ,GWL_WNDPROC,(LONG)SubClassStartFunc);
.
.
.
EnableButtons(hDialog, IDSTART , false );
.
.
}
void EnableButtons(HWND hDialog,int DlgItemID, bool flag)
{
HDC hdc = GetDC(GetDlgItem(hDialog,DlgItemID);
.
.// to change my drawing...suppose to gray my text.
.
EnableWindow(GetDlgItem(hDialog,DlgItemID),flag);
}
LRESULT APIENTRY SubClassStartFunc(HWND hWnd,UINT uMsg,WPARAM wParam,LONG lParam)
{
switch(uMsg)
{
case WM_PAINT :
{
PAINTSTRUCT ps;
HDC hdc = BeginPaint(hWnd,&ps);
RECT rect;
GetClientRect(hWnd,&rect);
....//code for drawing background
SetBkMode(hdc,TRANSPARENT);
DrawText(hdc,"Start",5,&rect,DT_CENTER|DT_VCENTER|DT_SINGLELINE);
EndPaint(hWnd,&ps);
break;
}
}
The problem is I could'nt change my drawing in original dilaog proc. ie inside the func EnableButtons(...) whatever I do its not affecting the button drawing. How should I do ? Suppose I want to change the text color when i enable and disable botton. Whatever I do in this function is affecting the button itself and not the drawing. And I have given the button property as ownerdraw.
Pls someone help.
|
|
|
|
|
WM_PAINT is sent as soon as the button needs to be redrawn. You are calling DrawText yourself, but not handling and button disabling. Furthermore, if you have an ownerdrawn button, you are not supposed to handle WM_PAINT.
To be honest, you seem to have mixed up things here. It might be easier to make a complete custom class if you are going to handle WM_PAINT . For owner draw buttons, you handle WM_DRAWITEM in the parent. But in any case, if you are drawing the button yourself, you must also include drawing code for the different states.
|
|
|
|
|
Hai all,
I still could'nt find the solution. I'm using win32 vc++ and subclass for drawing my button bagkground. ie.
BOOL CALLBACK DialogProc (HWND hDialog, UINT message, WPARAM wParam,
LPARAM lParam)
{
switch (message)
{
case WM_INITDIALOG:
{
lpfnOldWndProc1 = (WNDPROC)SetWindowLong( GetDlgItem (hDialog,IDSTART ) ,GWL_WNDPROC,(LONG)SubClassStartFunc);
.
.
.
EnableButtons(hDialog, IDSTART , false );
.
.
}
void EnableButtons(HWND hDialog,int DlgItemID, bool flag)
{
HDC hdc = GetDC(GetDlgItem(hDialog,DlgItemID);
.
.// to change my drawing...suppose to gray my text.
.
EnableWindow(GetDlgItem(hDialog,DlgItemID),flag);
}
LRESULT APIENTRY SubClassStartFunc(HWND hWnd,UINT uMsg,WPARAM wParam,LONG lParam)
{
switch(uMsg)
{
case WM_PAINT :
{
PAINTSTRUCT ps;
HDC hdc = BeginPaint(hWnd,&ps);
RECT rect;
GetClientRect(hWnd,&rect);
....//code for drawing background
SetBkMode(hdc,TRANSPARENT);
DrawText(hdc,"Start",5,&rect,DT_CENTER|DT_VCENTER|DT_SINGLELINE);
EndPaint(hWnd,&ps);
break;
}
}
The problem is I could'nt change my drawing in original dilaog proc. ie inside the func EnableButtons(...) whatever I do its not affecting the button drawing. How should I do ? Suppose I want to change the text color when i enable and disable botton. Whatever I do in this function is affecting the button itself and not the drawing. And I have given the button property as ownerdraw.
Pls someone help.
|
|
|
|
|
I want to programmatically disable "prompt me to save passwords" in IE's autocomplete. Does anyone know how to do this?
|
|
|
|
|
Registry:
HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main
"FormSuggest PW Ask"="no"
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Does it only stop automatically filling the password or does it also stop saving the password in the protected storage for later use if we choose to enable the option back?
Thanks.
|
|
|
|
|
See if the bottom half of MSDN article Q229940 is of any help.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
I came across another article on this subject - http://pubs.logicalexpressions.com/Pub0009/LPMArticle.asp?ID=348
This article doesnt talk about DisablePAsswordCaching mentioned in the MSDN article, but says that the password is always saved at SPW and "To remember or not remember is controlled by more complex binary values hidden deep under the Protected Storage key.".
Can someone shed light as to what this author means here and how it is different from DisablePAsswordCaching?
Thanks.
|
|
|
|
|
how do you minimize or maximize a dialog from a menu?
|
|
|
|
|
One way is to send the dialog a WM_SYSCOMMAND message.
UINT uCmdType = SC_MINIMIZE;
PostMessage (WM_SYSCOMMAND, uCmdType);
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
|
Hi Everyone,
I'm hooking a dos-based calculation engine("engine.exe") up to my GUI, and am having some problems. When I double click the engine.exe file, or run it from cmd it runs to completion and produces the correct output.
However when i attempt to run it from my program using either createprocess, or system(), it does not run and gives this output.
Abnormal program termination: Memory protection fault
CS:EIP = 01FFh:0000799Ch
I have swapped out the engine.exe path for several other programs, and they all work just fine from createprocess.
here is my createprocess line
fSuccess = CreateProcess((LPTSTR)ImageName,
(LPTSTR)CmdLine,
(LPSECURITY_ATTRIBUTES)NULL,
(LPSECURITY_ATTRIBUTES)NULL,
(BOOL)TRUE,(DWORD)0,NULL,
(LPTSTR)DirLine,
(LPSTARTUPINFO)&SI,(LPPROCESS_INFORMATION)& pi);
and startupinfo
SI.cb =sizeof(STARTUPINFO);
SI.lpReserved = NULL;
SI.lpDesktop=NULL;
SI.lpTitle="EngineProcess";
SI.cbReserved2=0;
SI.lpReserved2=NULL;
SI.dwFlags = STARTF_USESHOWWINDOW;
SI.wShowWindow = SW_FORCEMINIMIZE;
I'm just wondering if anyone has seen this before(unable to run dos-based programs from a VC++ program).
thanks,
Mike
"I bet Einstein turned himself all sorts of colors before he invented the light bulb." -- Homer J.
|
|
|
|
|
Just checl when launching it from double clicking it it doesnt add some command line parmeters to it self (Right click properties)
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
nope there's nothing, good thought though.
Mike
"I bet Einstein turned himself all sorts of colors before he invented the light bulb." -- Homer J.
|
|
|
|
|
I think you need to create a PIF file for the DOS program first? Never tried running a DOS app via CreateProcess(), though.
Also, look into the CREATE_NEW_CONSOLE for CreateProcess...
Bikram Singh
|
|
|
|
|
yeah, weirdest thing ...
It turns out that this problem only occurs when I launch my gui from the vc++ exclamation point (ctrl+F5)
when start the program by double-clicking the exe everything works exactly how it should.
Anybody know what extra options that exclamation-point button adds onto the executable?
thanks,
Mike
"I bet Einstein turned himself all sorts of colors before he invented the light bulb." -- Homer J.
|
|
|
|
|
With CTRL+F5, the debugger is invoked, and the program runs within the debugger.
I have experienced this anomaly before, but I cant exactly be sure why it happens. And I have seen it happen in other compilers as well...
Bikram Singh
|
|
|
|
|