|
Thks but i resolve the problem, its a bug of MFC, i resolve with this code (its a test code that i create it)
<br />
CMsnNvHookApp theApp; <br />
<br />
DWORD WINAPI ThreadStart (LPVOID dwThreadId) { <br />
::Sleep(300); <br />
<br />
AFX_MODULE_STATE *ModStat; <br />
<br />
ModStat = AfxGetStaticModuleState(); <br />
ModStat->m_pCurrentWinApp = &theApp; <br />
ModStat->m_hCurrentInstanceHandle = ::GetModuleHandle(NULL); <br />
<br />
AFX_MANAGE_STATE(ModStat); <br />
<br />
theApp.m_hThread = ::GetCurrentThread(); <br />
theApp.m_nThreadID = m_nThreadID; <br />
theApp.m_hInstance = ::GetModuleHandle(NULL); <br />
<br />
CFrameWnd *MainWin = new CFrameWnd(); <br />
<br />
MainWin->Create(NULL,"Prueba"); <br />
MainWin->ShowWindow(SW_SHOW); <br />
<br />
theApp.m_pMainWnd = MainWin; <br />
<br />
theApp.Run(); <br />
<br />
return TRUE; <br />
} <br />
<br />
BOOL CMyApplication::InitInstance() <br />
{ <br />
DWORD dwThreadId; <br />
<br />
::CreateThread(NULL,0,ThreadStart,0,0,&dwThreadId); <br />
<br />
return CWinApp::InitInstance(); <br />
}<br />
<br />
And i use a inject library called madCHook.dll <a href="http://www.madshi.net/">http:
|
|
|
|
|
I am practising writting a windows application purely by hand and by using windows API , as I am a beginner in windows programming and want to do some studying.
In almost all the explanations to the provided facilities, I find in the header section such statements as "declared in..., include windows.h", so I thought the facilities would be availabe so long as windows.h was included.
But that immediately proved wrong in compiling.
Yet more embarrassing is the function WinMain, I wrote it with returning type int, as is stated in MSDN, but the compiler(VC 6.0)reported errors for this.
Can you tell me how I can use the API functions and how to handled this problem?
Thank you for any help!
|
|
|
|
|
Well it would help if you listed the errors.
Have you tried using the AppWizard to generate a Win32 Application. This will help you to understand what is needed to create a pure Win32 app.
If you want to learn about the make-up of a Win32 app, I recommend this book[^]
Michael
CP Blog [^]
|
|
|
|
|
Thank you for your help!
I debugged the program again and solved some of the problems by myself. But the following one is really puzzling:
VC6.0 reported after compiling:
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
The WinMain function is written as follows:
int _stdcall WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow )
{
//register the window class and carry out things like that
}
I used the appWizard to create a win32 application and all the problems were gone. However, I still don't understand why the error was reported. _main is not defined in the win32 application either.
Thank you for all your help!
|
|
|
|
|
See if MSDN article Q291952 is of any help.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Just wanted to say thanks for posting this! I ran into the same problem and the article solved it for me! Thanks!!
Mike Ellertson
|
|
|
|
|
hey, just a tiny problem:
i use a CDialog with a couple of CustomCtrls arrange vertical. My CustomCtrl uses a CToolTipCtrl to display ctrl states.
When the Tooltip appears the control "under" the tooltip would not be repainted up to to the time the dialog call invalidate or the control gets the focus.
How can I solve that problem?
|
|
|
|
|
Hi,
I want to open multiple childs windows inside one of the childframe window of an MDI application. Any idea about how to achieve this?.
Details is like below:
I have my mainframe window derived from CMDIFrameWnd. Now in one of the childframe ( derived from CMDIChildWnd ) I want to open mutiple child windows i.e my child frame should behave as a parent to another child windows. Please let me know how to achieve this.
Any sample would be of great help.
Thanks,
Amit
|
|
|
|
|
The classic point to create child windows would in your CChildFrame::OnCreate handler.
I know the CSplitterWnd stuff goes there. You can also add toolbars etc at that point.
Iain.
|
|
|
|
|
Have a wierd one. One of our customers recently purchased a new computer with XP PRO installed. Out software prints fine on others customer's pcs running XP PRO, but this one wants to print everything upside down and backwards. Has anyone ever seen this happen. Would appreciate anyone's input.
Walt McWhirter
Compact Communications Systems
|
|
|
|
|
Have you tried putting the paper in the other way around?
More seriously, I would look at differences in printer / printer drivers rather than XP.
I used to have a lot of problem with Epson drivers when HP ones worked just fine.
Does the problem happen when you change printers? Does it happen on a known-good-system
with the suspect printer?
Does the issue happen if you print from another application? Or just yours? I usually
use Wordpad as a simple should-be-fine application.
Is it just an (obsure) option in the print setup?
Iain.
|
|
|
|
|
This is likely some really obscure print driver option that is running amuck, but if you solve it, I'd love to hear the reason. This sounds like a great trick to play on some of my evil co-worker's PC. :mwaahaaha:
Chris Meech
We're more like a hobbiest in a Home Depot drooling at all the shiny power tools, rather than a craftsman that makes the chair to an exacting level of comfort by measuring the customer's butt. Marc Clifton
VB is like a toolbox, in the hands of a craftsman, you can end up with some amazing stuff, but without the skills to use it right you end up with Homer Simpson's attempt at building a barbeque or his attempt at a Spice rack. Michael P. Butler
|
|
|
|
|
I have just compiled an old VC6 project in VS.NET 2003 and I am getting some odd errors. It's been a while since I did any C++ and am a bit rusty so any help would be appreciated.
In the following code:
template<class T> class COpList <br />
{<br />
public:<br />
<br />
COpList(); <br />
~COpList();<br />
<br />
bool ParseList(CTokenizer&);<br />
void StartIterator(void) const;<br />
const T* GetOp(void) const;<br />
<br />
void Display(ostream&) const;<br />
string GetAsText(void) const;<br />
<br />
private:<br />
<br />
void AddOpListElement(const string&);<br />
<br />
typedef vector<T*> OPVEC;<br />
OPVEC m_vecOpList;<br />
mutable vector<T*>::const_iterator m_it;<br />
};
The last line in the class (in bold) is giving the error:
error C2146: syntax error : missing ';' before identifier 'm_it'<br />
What is it telling me? I have looked it up in help and it seems to have something to do with specialisation but, as I say, I am kinda rusty on C++. Any help would be appreciated.
Thanks
Paley.
Rugby League: The Greatest Game Of All.
|
|
|
|
|
Have you got an #include <vector> at the top of the .h file?
Ant.
|
|
|
|
|
Yes, sorry I forgot to include it in my post.
Microsoft have tightened up on C++ compatability in VS.NET so I think it is something to do with that, in particular specialisation in templates. I wrote this stuff a few years ago (it's a programming language compiler/interpreter) and haven't been keeping up to date so if anybody can point me in the right direction as to why this is happening it will be appreciated.
Rugby League: The Greatest Game Of All.
|
|
|
|
|
Along the lines of the other post:
Have you tried replacing your vectors with std::vector ? Or are you using namespace std; ?
"Fish and guests stink in three days." - Benjamin Franlkin
|
|
|
|
|
I have using namespace std;
It compiles fine in VC6 - the issue is to do with template specialisation although I am not using it.
Rugby League: The Greatest Game Of All.
|
|
|
|
|
Change the line to
mutable typename vector<T*>::const_iterator m_it;
The opinions expressed in this communication do not necessarily represent those of the author (especially if you find them impolite, discourteous or inflammatory).
|
|
|
|
|
Excellent, that works a treat, thank you very much.
Can I ask why it work?
Rugby League: The Greatest Game Of All.
|
|
|
|
|
"The typename keyword is required if a dependent name is to be treated as a type. This is a breaking change in the Visual C++ .NET 2003 compiler, made in order to conform to the ISO C++ standard."
The opinions expressed in this communication do not necessarily represent those of the author (especially if you find them impolite, discourteous or inflammatory).
|
|
|
|
|
Thanks, you have been a big help.
Rugby League: The Greatest Game Of All.
|
|
|
|
|
IIRC, this also affected the WTL 7.0 source, specifically the printing stuff, so Nenad had to change the code in exactly the same way. Nice to know that MS get caught out just like us mortals....
Steve S
|
|
|
|
|
I'm creating a Time Series Viewer, an I'd like to let the user chose the path he wants (where he has his data).
The problem is I'm not used to MFC, and I'd like to know if there is a way to avoid creating a complicated dialog box.
If I am to do it, how do I include it to my other project, that's to say: how do I tell my main project to call this dialog box when I want it to do so, and how do I get the input in memory to use it?
Thanks
|
|
|
|
|
|