|
Try WM_NCLBUTTONDOWN and WM_NCLBUTTONDBLCLK .
---
Shog9
If I could sleep forever, I could forget about everything...
|
|
|
|
|
|
Yeah, good point.
---
Shog9
If I could sleep forever, I could forget about everything...
|
|
|
|
|
How do you add them. Neither is in the class wizard, and I've tried manually writing them in but they never get called.
I've tried puttingON_WM_NCLBUTTONDOWN() in the cpp, afx_msg void OnNcLButtonDown( UINT nHitTest, CPoint point); in the header, and I added the function to the cpp, but it never gets called. Why doesn't it work?
|
|
|
|
|
What sort of a window is this?
---
Shog9
If I could sleep forever, I could forget about everything...
|
|
|
|
|
Child window of an MDI.
-Raffi
|
|
|
|
|
Raffi wrote:
Child window of an MDI.
A direct child of the MDI client window, or a view? If it's a view, then it doesn't have a title bar of it's own, so you're not going to get the messages that way.
---
Shog9
If I could sleep forever, I could forget about everything...
|
|
|
|
|
Ahh, I had it in the view, got it working now, Thanks a lot
-Raffi
|
|
|
|
|
Hi,
I'm just a beginner with C++. I'm using the MS Visual Studio 6.
I would like to write a small .exe file that will copy backups of .ini files for a game, over the existing ones. This is to prevent other guys from changing my settings.
How the copying part in C++ is done, is not a problem. But I can't figure out how to start up the game.exe from within the small prog that I'm working on.
The small .exe file should also quit running after the game.exe is executed.
I'll guess it would be easy to just make a BAT file to handle it all, but then I wouldn't learn anything about C++ by doing so.
Anyone out there who got a clue or a small codesample to hand over?
Best regards, Peter
|
|
|
|
|
Look up CreateProcess in MSDN. That is the call to use to launch another program.
|
|
|
|
|
Try ShellExecute then end the program. exit in a console app
good luck,
Bill
|
|
|
|
|
Thank you, both of you guys!
I tryed to read the MSDN just after I read your suggestions, but as I'm quite new on C++ it turned out to be too technical for my right now. The compiler didn't swallow my attempts that I tryed 5 minutes ago.
I found out that it is easier to learn something complete knew by studying existing examples. Is there any codesample out there which I can play around with?
Best regards, Peter
|
|
|
|
|
|
Dear Nishant S,
To avoid wasting bandwith on this excellent discussion forum, I've emailed you some further questions.
Regards,
Peter
|
|
|
|
|
Anonymous wrote:
To avoid wasting bandwith on this excellent discussion forum, I've emailed you some further questions.
Please post your questions in the forum, because then other people will also be able to help you. I usually don't answer to direct emails and often don't even read them. I already have a problem keeping my mail organized. And the big advantage of asking questions in the forums is that the answers will remain there for other people to see in future if they run into the same problems.
Regards,
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Review by Shog9
Click here for review[NW]
|
|
|
|
|
Okay, I'm trying to load the raw data of a resource of a custom type. I've named the type "JPG" and have created a resource with the ID "IDR_JPG1". The resource is located within the executable. The code that I've come up with is:
char* pData = 0;
HRSRC hRsrc;
HGLOBAL hGlobal;
DWORD dWord;
hRsrc = FindResource( NULL, ?, RT_RCDATA );
dWord = GetLastError(); // Produces 1813 (ERROR_RESOURCE_TYPE_NOT_FOUND)
hGlobal = LoadResource( NULL, hRsrc );
pData = (char*)LockResource( hGlobal );
I have no idea what I need to be putting in place of the question mark. The MSDN Library provides only unclear and essentially useless information. Also, I'm a little uneasy about locking up a resource and not releasing it. Do I need to release it? There is a FreeResource function but I'm told that it is depricated. I'd appreciate any info you could send my way.
|
|
|
|
|
Okay, to answer my own question . . .
hRsrc = FindResource( NULL, MAKEINTRESOURCE( IDR_JPG1 ), "JPG" );
Corrects the problem
|
|
|
|
|
Hello,
I am trying to force regedit to export a version 4 .REG file instead of version 5. This is an option in regedit, however I am using the command line
regedit /e filename destination to do my backup. I have searched msdn and other places looking for documentation on what arguments can be passed here to force a regedit 4 export, but have had no luck at all. Does anybody have any experience with this, or know where I can look for some documentation??
Thanks
Is it football season yet?
|
|
|
|
|
I've got an MDI MFC app.
(Irrelevant info in parentheses probably: I have a database class(built from ADO) )
An object 'db' is declared in view1. It opens a database which has to stay open while the program is running. Now I want to run one of the functions of db, in view2. View2 transmits a piece of information that is to be used in the argument list of the function. I need to use the same object, so I cant create a new one (cant open an already open database connection). What is the best mechanism to do this?
I was wondering about:
I only have two views and this tactic worked when I did a sendmessage from view2 to view1. But in the dropdown intellisense after doing pView-> I saw only the names of functions and didnt know if I could get to the db object as above.
Please let me know.
Thank you very much,
ns
The above snippet said that db was not a member of CView. I tried forcing it to be CTrain1View * (totally wrong I know) but was not acceptable to the compiler either.
Do I have to go via Doc variables and a sendMessage?
|
|
|
|
|
ns wrote:
An object 'db' is declared in view1. It opens a database which has to stay open while the program is running.
What stopped you from including 'db' in CYourDoc?
Tomasz Sowinski -- http://www.shooltz.com
What is "scratch" and why can everything be made from it?
|
|
|
|
|
It didnt want to do simple recordset functions like get record count etc. It bombed if I made it a doc object because the constructor creates all the objects like command and recordset etc. Thats why I put it in the View....
Thanks,
ns
|
|
|
|
|
in general, you should put all data and data manipulation functions in the doc and all data display functions in the view. the view should have very little to do with changing the data (except as is necessary to run the UI). anyway, that's the principle behind doc/view.
i usually send all data-changing UI events from the view to the doc, then let the doc call UpdateAllViews with enough information that the views can correctly show the data change. i rarely let the view actually change (and never store) the data directly.
-c
To explain Donald Knuth's relevance to computing is like explaining Paul's relevance to the Catholic Church. He isn't God, he isn't the Son of God, but he was sent by God to explain God to the masses. /. #3848917
|
|
|
|
|
I really wanted to do that, but as I said in my prev email, simple functions like fields->recordcount etc (native ADO functions) were crashing. The same object instantiated in the view performed fine! I'll try again, but am not confident they will work in the doc...
Thanks for your input,
ns
Gave it one final try as a doc object.....I think it may work! Some functions are anyways. Thanks so very much for the pointers
ns
|
|
|
|
|
While I agree that the db member should be in the doc and not in the view, there's nothing programatically wrong with what you've been doing. IntelliSense cannot show you the members of CTrain1View since your pView is of type CView*, but casting it to CTrain1View* should work:
POSITION pos = pDoc->GetFirstViewPosition();
while (pos!= NULL)
{
CTrain1View* pView = (CTrain1View*)(pDoc->GetNextView(pos));
ASSERT_VALID(pView);
pView->db.MyFunc(arg from view2);
}
But of course, hard-coding a type cast like this is error prone. You could make it a little nicer by checking the type before the cast:
CView* pView = pDoc->GetNextView(pos);
ASSERT_VALID(pView);
if (pView->IsKindOf(CRUNTIME_CLASS(CTrain1View)))
((CTrain1View*)pView)->db.MyFunc(arg from view2);
Still, putting it in the doc is the right thing to do.
Cheers
Steen.
"To claim that computer games influence children is ridiculous. If Pacman had influenced children born in the 80'ies we would see a lot of youngsters running around in dark rooms eating pills while listening to monotonous music"
|
|
|
|
|
when I run an MDI application and keep clicking down a non-client
area of a window, all other window look dead, which means they
don't draw anything on their client area. This is critical when
I develop a timer based application because all the timer message
are also blocked by keeping down my mouse cursor on a non-client
area of a window.
I want to avoid this. I want to make all windows run although I
keep clicking down the caption bar of a window.
Does anybody know a solution for this problem?
|
|
|
|