|
What you want to do is to encapsulate all low level API details, so that your library can be used anywhere. Right?
Well, if that's the case, you should not create a light wrapper. What you are doing is coupling the API calls in one object.
What you want to be doing is define a set of styles for the window. Define all the other stuff yourself also (windows messages, controls, etc..) and in your code, translate this stuff into windows API calls. This way, you can provide different implementations (makes your project portable). In the ideal case, you don't have to modify your application when you compile it under Linux or whatever GUI. The only thing that has to be done is to use a different implementation of your library!
To get back on track here and to answer your question: I think that you should go for the two stage window construction. One rule is to never throw an exception from a constructor. So here you have almost no way of notifying the caller of your code that creation failed.
One other suggestion though. For abstraction purposes, you should hide implementation details. The win API is an implementation detail. So hInstance variables should be hidden. The raw styles should be hidden. Try to hide as much handles as you can, etc, etc..
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
Hi, Im developing a speaker identification security system for my computer. I've created the software but I need help in making it block the screen while it runs. Your suggestions will be highly appreciated.
|
|
|
|
|
Perhaps you should explain in more detail what "block the screen" means.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
Yeah, because at first I was thinking he could stand in front of it
My wife often proclaims, "You make a better door than a window!' whilst I stand in front of the TV when her soap opera is on
|
|
|
|
|
My best guess is a "how to lock" a screen. You can draw a big form, maximized, borderless, on top of all the rest.
michael.code.ae
|
|
|
|
|
Can anyone point out the differences between Visual C++ 7.0 (.Net) and Visual C++ 6.0?
Thanks
|
|
|
|
|
For strict C++/MFC code, the compiler is a lot more compliant and strict; I believe there are minor changes to MFC and ATL to merge some classes ( I think the CString is one of them ).
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
|
I am a c++ beginner programmer
I want to take an image from my webcam and put it in buffer using directshow,
and any directshow tutorial.
Please help me.
Gohary
|
|
|
|
|
Here are several Tutorials to DirectShow, also for Capturing. Perhaps you also want to have a look at the DirectShow Docs coming with your DXSDK.
http://www.codeguru.com/Cpp/G-M/directx/
rya.
Scorcher24
|
|
|
|
|
when variable i increase to some value(not definite),exception occurs,is it a bug of ie6.0? Thx a not!
Source code goes as follows:
IHTMLDocument2* pDoc2=NULL;
IHTMLElementCollection* ppCollection=NULL;
IDispatch* ppvdispOption=NULL;
pDoc2->get_all(&ppCollection);
Assert(ppCollection);
ppCollection->get_length(&Count);
for (long i=0;i<count;i++)
{
=""
="" _variant_t="" index="" ;
="" try
="" ppcollection-="">item(index,index,&ppvdispOption);
}
catch (...)
{
tagstr.Format("%d",i);
AfxMessageBox(tagstr);
return FALSE;
}
if(!ppvdispOption)
continue;
ppvdispOption->QueryInterface(IID_IHTMLElement,(void **) &pElement);
ppvdispOption->Release();
//.........
}
|
|
|
|
|
123ivan123 wrote:
IHTMLDocument2* pDoc2=NULL;
IHTMLElementCollection* ppCollection=NULL;
IDispatch* ppvdispOption=NULL;
PROBLEM IS HERE
pDoc2->get_all(&ppCollection);
pDoc2 haven't got any memory!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
u r there but "not" luking at my problem... i meant it,, but toxxct gave the answer for that ..
V
|
|
|
|
|
if he doesn't know the answer, why would he overload the servers ?
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Vivekuniq wrote:
u r there but "not" luking at my problem.
Yeah i looked at your problem, But when I see Tox already given you the answer, So i think there is no need of redundancy .
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
toxcct wrote:
if he doesn't know the answer
Usually I don't answer when somebody already given the answer
toxcct wrote:
why would he overload the servers ?
, Hain Tox i would be working On VC Forum Q&A 5 now (i.e. 2 and 3 is on you).
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
ThatsAlok wrote:
On VC Forum Q&A 5 now
ok... i'm on a now project at work, but i'm doing my best to mix everything in time...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Hi,
I downloaded a sample mfc project that builds and runs fine. But when I add any ActiveX control on one of the forms, it fails to start. What could be the problem?
Emmanuel Mwesigwa @ Mwemat
|
|
|
|
|
Could it be that the ActiveX control has not been registered? You can confirm this by ensuring that the dialog has the DS_NOFAILCREATE style.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
Hi all.
I have a dialog, that is a plugin for another application.
The problem is that my dialog works nice when i launch it from the other application, except TASB navigation and shortcuts.
When i test the dialog from Layout->Test, the TAB navigation works nice, but when i try to use tab navigation from my dialog launched from the host application i am not able to navigate with the TAB key.
In addition accelerators keys don't work with my dialog.
Any clues, maybe i have to explicitely get the TAB control? how can i do this?
Thanks
|
|
|
|
|
Could it be that the other application is trapping (e.g., not processing) the tab key such that your dialog does not see it?
lisux wrote:
Any clues, maybe i have to explicitely get the TAB control?
A tabbed dialog box (i.e., property sheet) has nothing to do with using the tab key to navigate controls on a dialog.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
This is a sign that the other application is not calling IsDialogMessage, to give your dialog a chance to process 'dialog messages' like accelerators and tab keys between controls. Perhaps because it does not know that a dialog is up on the screen?
If the other application has a custom message loop, check it to make sure it at least does TranslateMessage() and DispatchMessage, but the handling you are missing is definitely performed by the IsDialogMessage call.
|
|
|
|
|
Hi!
My problem is that when i move my application to another machine it doesn't work. The problem is with the links. I have a very simple cdhtmldialog dialog and here is its html resource. it contains two frames and i want to load a file to each one of them. Everything works fine on my computer, but when i deploy the application links stop working. How i fix this links...i tryid src="file:///juqu.htm", src="juqu.htm", src="./juqu.htm",... and much more...but nothing works...The html file that i want to load is in release directory with .exe file. thax for the help.
<title>A simple frameset document
<P>This frameset document contains:</p>
hussein
|
|
|
|
|
|
i'm using winsock.h for a simple c/s program.. in that, when i close the client.. the server is getting into a loop.. which keeps on prints the value previously received from the client...
how to handle the exception? i used try{ } catcb{} but i'm not sure it's in its correct form!.. plz help
Thanks,
V
|
|
|
|