|
Just put the CFile::Close() method into it's own try/catch block and that way you will know which function has thrown the exception. In terms of wether an exception 'knows' what function it has been thrown from, I don't believe that this exists.
Chris
|
|
|
|
|
I want the application window to have a gray background upon start up.. does anyone know how to do it?
|
|
|
|
|
Two ways. 1 - When you register your window class, create a gray brush and pass that as the background brush in the WNDCLASS(EX) struct. 2 - Handle the WM_ERASEBKGND message and paint the gray background when that message is sent to you.
--Mike--
http://home.inreach.com/mdunn/
The Signature, back by popular demand: Buffy. Pajamas.
|
|
|
|
|
In your window class that is registered set the brush to the stock brush index of COLOR_BTNFACE if you don't think the user will play around with their windows color scheme else pass in the handle to the GRAY_BRUSH from GetStockObject.
Cheers,
-Erik
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
My thoughts are my own and reflect on no other.
|
|
|
|
|
<<< In the name of GOD >>>
Hi all.
How can i save RichEdit data to file ?
I wrote it, but it have errors ...
static DOWORD CALLBACK MyStream(DWORD dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb)
{
CFile *pFile = (CFile*) dwCookie;
pFile->Write(pbBuff, cb);
*pcb = cb;
return 0;
}
void CTestDlg::OnOK()
{
EDITSTREAM es;
CFile file("c:\\test.txt", modeCreate);
es.dwCooikie = (DWORD) &file;
es.pfnCallback = MyStream;
m_RichEdit.StreamOut(SF_RTF, es);
}
If possible write example about saving richedit data to file.
Thanks for reply.
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
I'm trying to convert a series of 3D points (XYZ) to a 2D (XY) surface.
In my application a series of lines run along the axes (think of pipes fitted together with elbows, tees, and crosses), they are 90 deg to each other.
I simply do the following to map my XYZ points to the YZ plane:
xp = (z + x * COS_45);
yp = (y + x * SIN_45);
This is not quite right. When drawn on a metafile, lines in the Z direction run Parallel to bottom edge, they should actually be at 30 deg. I can see that I need to get an x and y added value from the z-component, however I haven't had much luck.
A simple set of points:
(0,0,0)
(20,0,0)
(20,20,0)
(20,20,20)
(40,20,20)
Does anyone have the appropriate transformation/formula that I should use? Or good place to look? (I was trying to avoid matrices and doing some type of world to eye to screen transform - it seems it should be easier, since all my lines are at 90's)
Thanks
Mike
|
|
|
|
|
I have a 2 Column CListCtrl and I need to edit the text on the CListCtrl by DoubleClicking on the cell(in second column)
Would some one give a hint on how to do this.
Thanks
Iraivan
|
|
|
|
|
I develop a dialog box when I use the monitor resolution to 1024x760. However, I found that if i change the resolution to 640x480, the dialog box will be too big. How can I make the dialog to use two scrollbars in order to prevent this problem???
|
|
|
|
|
Scrollbars on a dialog are not a good idea IMHO, You would be better of breaking the dialog into smaller related peices and using a property sheet/pages.
P
|
|
|
|
|
Hi,
I am getting "DDE Server Window: seqncr.exe - Application Error" message, when I try to register my Exe application.
Note: seqncr is my exe name
I tried using seqncr /REGSERVER at the command prompt to register the exe.
I am getting this error only for Release version, not for Debug version.
Can anybody help me out with the various reasons, whcih will cause this error.
Thanks lot in advance!!
Rupanagudi
|
|
|
|
|
Anyone know a good XML Parser AND Writer Ansi C(++) class/Library. (Could not find what I was looking for on this WebSite).
Can be commercial, but preferably free.
--------------------------------------------------
If my messages appear curt, I apologize.
I try to be brief to save your time as well as mine.
--------------------------------------------------
|
|
|
|
|
The Xerces parser is pretty good for parsing and manipulating the DOM. My biggest problem is that, when I last looked, you have to write your own code to save an XML file. The Xerces parser, if your curious, is located at 'http://xml.apache.org/xerces-c/index.html'.
Jamie Nordmeyer
Portland, Oregon, USA
|
|
|
|
|
I'm using the latest Platform SDK from MS and have the latest SP for VC++6.0 installed on an ME platform . . . for some reason when I try to register a window class with RegisterClass() or RegisterClassEx() the call fails and GetLastError() returns ERROR_CALL_NOT_IMPLEMENTED. Does anyone know what's going on? It seems odd to me that I can't create the main class that Windows is founded on.
-Michael
|
|
|
|
|
Please be more specific - how do you initialized members of the WNDCLASS or WNDCLASSEX struct?
In the docs for RegisterClassEx, I've found the following info:
"Windows 95: RegisterClassEx fails if the cbWndExtra or cbClsExtra member of the WNDCLASSEX structure contains more than 40 bytes."
Not sure if this applies to WinME.
Tomasz Sowinski
http://www.shooltz.com.pl
|
|
|
|
|
Sorry . . . here is my WNDCLASS struct. I've found that RegisterClass() works when compiled on VC++ without the Service Packs and without the Platform SDK upgrade.
Could there be some variable I need to #define?
MSG msg;
WNDCLASS wc;
CREATESTRUCT cs;
wc.style = NULL;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.lpfnWndProc = (WNDPROC)MainWndProc;
wc.hCursor = NULL;
wc.hIcon = NULL;
wc.lpszMenuName = NULL;
wc.lpszClassName = "SystemControlClass";
wc.hbrBackground = HBRUSH(GetStockObject(WHITE_BRUSH));
if (!RegisterClass(&wc))
{
#ifdef _DEBUG
DWORD dwLastErr = GetLastError(); // I check this variable in the
// debugger.
#endif
return FALSE;
}
-Michael
|
|
|
|
|
On my machine (W2K, VC++ 6.0/SP5, no Platform SDK update) it also works.
RegisterClass is #defined in winuser.h as RegisterClassA or RegisterClassW, depending on the value of UNICODE macro:
#ifdef UNICODE
#define RegisterClass RegisterClassW
#else
#define RegisterClass RegisterClassA
#endif // !UNICODE
Assuming that in your project UNICODE is definded, your program will link with RegisterClassW. I don't have ME machine, so I can't check if this OS exposes 'stub' for RegisterClassW that simply returns ERROR_CALL_NOT_IMPLEMENTED. Without the stub, your program wouldn't load - you'd get the error message box saying that loader can't find the imported function in the USER32.DLL
You can check which variant your program calls by using depends.exe. The function should be exported from USER32.DLL.
Tomasz Sowinski
http://www.shooltz.com.pl
|
|
|
|
|
Hi.
I'd like to close an application by sending to its main window the WM_CLOSE message.
What I do is getting the ID of the process I want to stop, and then I use EnumWindows()
function to get all top-level windows in the screen and in the callback function
EnumWindowCallBack(), I compare the process ID with the ID of each top-level window.
When the ID is the same, I send to the window the WM_CLOSE message thanks to ::PostMessage().
But, unfortunately, it doesn't work all the times. It seems that the windows I get in
the callback function EnumWindowCallBack() are not the main windows of the applications
I want to stop... For example, with calc.exe, the window is closed after having posted
the WM_CLOSE message twice but the process calc.exe is still running without a window...
Has anyone already met this problem ?
Is there a way to be sure to get the right window of an application (and not a child window
that doesn't handle the WM_CLOSE message) ?
Thanks.
|
|
|
|
|
Knowledge Base article Q178893 - "HOWTO: Terminate an Application 'Cleanly' in Win32" - deals with these issues. Basically, you should call WaitForSingleObject after posting WM_CLOSE.
You can find the article online:
http://support.microsoft.com/support/kb/articles/Q178/8/93.ASP
Cheers
Tomasz Sowinski
http://www.shooltz.com.pl
|
|
|
|
|
How must I amend the code generated by the Appwizard to prevent the document view from appearing upon start up?
I am making a SDI App.
desperdao...
|
|
|
|
|
Basically, SDI app always has some document created. You have to be tricky if you don't want a document. You can check the "C++ Q & A" column by Paul DiLascia in the November 1996 issue of Microsoft Systems Journal - the author describes the necessary steps.
You can find the article in the MSDN, also online:
http://msdn.microsoft.com/library/periodic/period96/S204D.htm
Cheers
Tomasz Sowinski
|
|
|
|
|
This is how I did it in my app's InitInstance(). (Its an MDI app though):
.
.
.
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
//disable LOADING OF A NEW FILE AT STARTUP
cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing;
// Dispatch commands specified on the command line
if (!ProcessShellCommand(cmdInfo))
return FALSE;
.
.
.
Look up CCommandLineInfo in MSDN for more info
Josh
josh@schroff.com
|
|
|
|
|
I use m_pDesktopFolder->ParseDisplayName(...);
The problem is it works fine when I parse a name from a "real" directory that I created myself named "Spel", but when I try to parse the name of a virtual folder "Den här datorn" (Swedish; aka "My computer" in English) the function fails.
So: How can I get the PID of a virtual folder such as "My computer" with the ParseDisplayName(...); I tried both English and Swedish name of the virtual folder, none works.
Any ideas?
Cheers,
Henrik
|
|
|
|
|
Hi,
I want to make a menu bar like in Internet Explorer, so the user could b able 2 locate the toolBar and the menuBar at the same line.
Does anyone have done it before?
Please help me...
|
|
|
|
|
Hi,
look at the Platform SDK under "User Interface Services/Windows Common Controls/
Common Controls How Tos/Creating an Internet Explorer-Style Menu Bar"
|
|
|
|
|
Hi all!
How can I set the icons for the files in the list ctrl in a CFileDialog?
The files don´t have any icons associated with them and I don´t want that either.
I also would like not to have the file extensions shown.
Thanks,
Daniel
|
|
|
|