|
Thanks David,
I downloaded the sample program for SHBrowserForFolder() from codeproject.
That was it.
Thank you very much.
Shin
|
|
|
|
|
I have a CFormView with buttons in it. My application is a tic-tac-toe application, i would like to save the game before it is completed and be able to open it. how do i serialize it?
|
|
|
|
|
Search CP and MSDN for examples of serialization. Basically, the document object holds the state of the game. When the game is altered in any way (e.g., a move is made), the document should be marked as "dirty." Then when the game is exited, the document's Serialize() method will get called. It's at that point that you'll write to the CArchive object.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
See is how you are using CFormView I assume that you have a document class assotiated with it.
1) Open you document class and find Serialize().
2) if( ar.IsStoring() )
{
ar.Write(...);
}
else
{
ar.Read(...);
}
With a little effort and reasearch in MSDN you should have not problem.
P.S. This looks like a college assignment I had once add (accept in 'C' not MS 'C++').
After you get complete the assignment and get a grade, please send be a copy and I'll send you one of my versions (C,C++,VB), there are only to possibilies 1) possible and imposseble to beat.
INTP
|
|
|
|
|
Hello!
I have written small app in VC.NET and tried to run it on Win98. It complains about oleacc.dll. How to get rid of this dll from my app??
Anybody knows?
Please help
|
|
|
|
|
You have to delay the loading of the oleacc.dll file. By doing this, the dll will only get loaded if your app requires it, not automatically when your app starts.
1.) Link to delayimp.lib
#pragma comment (lib, "delayimp.lib")
2.) use the /DELAYLOAD:oleacc.dll linker option
Project
+-- Properties
+-- Linker
+-- Input
+-- Delay Loaded DLLs -> oleacc.dll
3.) use the /DELAY:UNLOAD linker option
Project
+-- Properties
+-- Linker
+-- Advanced
+-- Delay Loaded DLL -> Support Unload (/DELAY:UNLOAD)
Version 7.0 of Dev Studio
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
Hello!
I didn't look correctly. Oleacc.dll is not loaded by me by explicit. It is loaded by shell32.dll. It is present on WinXP, but not on clean installation of Win98 secont edition.
Anyone knows sth about this horror dll?
Thanks for help!
|
|
|
|
|
|
called from here:
#include "file1.h"
func.cpp
{
AF_TXT_FILE = OPEN_AIRFIELD_TXT_FILE(FILENAME);
}
file1.ccp
FILE * OPEN_AIRFIELD_TXT_FILE(char *FILENAME)
{
//function here
}
file1.h
FILE * OPEN_AIRFIELD_TXT_FILE(char *FILENAME);
Here is the ERROR:
error LNK2001: unresolved external symbol "struct _iobuf * __cdecl OPEN_AIRFIELD_TXT_FILE(char *)" (?OPEN_AIRFIELD_TXT_FILE@@YAPAU_iobuf@@PAD@Z)
I hope this make sense as I've took out a lot of code and makde up short names and such.
|
|
|
|
|
Just guessing, but is file1.cpp part of the project and if not, does it compile with no errors in whatever project it is in? If it is in a separate project, do you link with the .lib or .o file produced in that project?
Chris Meech
It's much easier to get rich telling people what they want to hear. Chistopher Duncan
But for a man, barbecuing eggplant and portobello mushrooms is a sure way to have people question your sexual orientation. Kuro5hin
|
|
|
|
|
I have a dialog based application. The main dialog contains a tab control and several child dialogs, one per tab on the tab control. (The child dialogs are children of the main dialog, not of the tab control.) When a tab is selected, I hide the currently visible child dialog, move the child dialog associated with the newly selected tab so that it immediately follows the tab control in the Z-order, and make the newly selected child dialog visible.
This all seems to work fine, except sometimes list controls in the child dialogs disappear. I say they disappear, because they do get drawn, but are immediately erased. If I start clicking on portions of the list control, pieces of it will be drawn. For example, if I click on an item, the item will be drawn. If I click on a scroll bar, the scroll bar will get drawn.
Any ideas?
--------
There are 10 types of people in this world. Those who know binary and those who don't.
|
|
|
|
|
I had that problem too: Back then I've figured out that the reason for that behaviour was screwed up message pump: WM_PAINT from dialog becoming visible was getting processed before WM_ERASEBACKGROUND of hidden one is getting processed -- both containing same screen device context.
The only solution I came up with back then was: instead of playing with Z-order and visibility -- I was just moving window that becomes "invisible" somewhere to Hawaii without changing visibility, while moving "visible" one to the right position.
Another side effect as I recall right now was: if you use IE WebBrowser window as your property window and change it visibility to not-visible -- it's getting destroyed -- therefore moving technique in my case was the only appropriate solution...
Regards
"...Ability to type is not enough to become a Programmer. Unless you type in VB. But then again you have to type really fast..."
Me
|
|
|
|
|
Thanks for the response.
I actually found the apparent "what was causing this", but I still don't understand the "why". I had a call to SetFocus that was setting the focus to the list control (before it would have been painted). Removing this SetFocus call appears to have solved the problem.
I had used Spy++ to look at the WM_PAINT and WM_ERASEBKGND messages. In agreement with your posting, the order of messages didn't make much sense and would fairly clearly cause the problem I experienced.
If anyone has any insight on the "why" of this problem, curiosity is killing this cat.
--------
There are 10 types of people in this world. Those who know binary and those who don't.
|
|
|
|
|
Where was SetFocus() being called from?
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
It was being called after I was done adjusting the visibility and Z-order of the child dialogs but before the message pump was allowed to run. I'm pretty sure it was the last thing to happen before returning to the message pump.
--------
There are 10 types of people in this world. Those who know binary and those who don't.
|
|
|
|
|
i need to be able to load a bitmap and let the user split it up into multiple parts and save the parts to files but i don't know how to split it up... or do the saving...
the user just sets the rows across and down then the program cuts up the bitmap into pieces and save them to a folder...
thanks,
-Slim
*SlimGradey*
|
|
|
|
|
Spilling a bitmap into multiple parts is the easy part, so I'll address that.
If you are going to spilt the bitmap into equal parts then it is simply a matter of creating 1 bitmap for each part and then blitting from the origanal to the new bitmap.
Example:
(0,0) (100,0) (200,0)
+-----------+-----------+
| | |
| part 1 | part 2 |
| | |
(0,100) +-----------+-----------+ (200, 100)
| | |
| part 3 | part 4 |
| | |
(0,200) +-----------+-----------+ (200,200)
1) Create compatible bitmap 1 (100, 100)
part1.blit(0,0,100,100,hdcSource,0,0)
2) Create compatible bitmap 2 (100, 100)
part2.blit(0,0,100,100,hdcSource,100,0);
3) Create compatible bitmap 3 (100, 100)
part3.blit(0,0,100,100,hdcSource,0,100);
4) Create compatible bitmap 4 (100, 100)
part4.blit(0,0,100,100,hdcSource,100,100);
Now you have 4 bitmaps that only contain a part of the origanal.
The trick is saving them to disk!
You can start with by searching for dibsection (and GetDIBits()) in MSDN and at codeproject, codeguru, and sourceforceforge. To use dibsection (or GetDIBit()) you will need to use CBitmap:Bitmap() or ::GetObject(pBmp,sizeof(BITMAP)) and do some calculations in order to figure out what the BITMAPFILEHEADER and BITMAPINFOHEADER will need to contain in order to save the file.
Note: GetDIBits() is your best bet. All you need to to do is create a BITMAPINFOHEADER and pass it to GetDIBits() let it fill in the BITMAPINFOHEADER for you, then let it calculate the amount of storage needed for the image (pixel bits) then call it again to retrieve the image. Then create the BITMAPFILEHEADER and write the results to disk. In reality it's a bit more complicated, but a search of MSDN and the WEB should ease you burdon.
I leave the rest up to you! Search MSDN on how to use GetDIBits().
INTP
|
|
|
|
|
How do i handle events for a Cbutton object created at run time ? Are there many ways of doing this ?
|
|
|
|
|
If you know the ID of the generated buttons at build time (or the range) you could put an ON_COMMAND( id, handler ) entry in the container's message map, but you'll want to put it outside the section managed by the class wizard.
Check out ON_COMMAND_RANGE as well, which might be more useful.
Steve S
|
|
|
|
|
Hi ,
If i do that how do I maintain an unique identifier for my Button !
as of now I am doing this
resetButton->Create("Reset Data",0,bRect,parent,0);
Engineering is the effort !
|
|
|
|
|
Assuming that the CButton is being placed on a dialog and it is not always needed, then use the dialog editor to place the button and set the visibal propety to false. That way you can change it to true only when it is required.
If you are placing the button on a window, you could try processing the command in the preprocessor function before it is passed to the window, or add you own WM_COMMAND() to the message map and add the function to handle it manualy.
INTP
|
|
|
|
|
How do you add messages to the mess. map for controls that are not created using the Dialog Editor, but in run time?
|
|
|
|
|
Having a problem with some registry keys. The MFC command ReqQueryValueEx requires that the name of the key be passed as a pointer to a null-terminated string, or to use their wrapper, an LPTSTR. My project accepts a vector of std::strings. Is there an easy way to convert those into LPTSTR's? I've tried every cast and conversion I could think of, but I don't know these types too well. Thanks.
"He looked rather, in his coat, like a sack full of elderly squirrels attempting to escape."
- Douglas Adams
|
|
|
|
|
LPTSTR is equivalent to char* or wchar_t*, depending on whether you've an MBCS/ANSI or UNICODE build respectively.
Steve S
|
|
|
|
|
Sorry, I should have been more clear with my first post, I was in a hurry. I thought the problem was most likely with how I'm using RegQueryValueEx. Here's what my code looks like:
queryD = RegQueryValueEx(curKey, names[m].c_str(), NULL, &datatype, (LPBYTE)buffer, &bufferlength);
where: curKey = open HKEY, names = std::vector{std::string}, datatype = DWORD, buffer = TCHAR[], and bufferlength = DWORD
This compiles and runs, but does not successfully open any of the keys that it is passed, the return value is 234. As a longtime *nix programmer just making the move to MS programming, I'm starting to get frustrated with this. Any help you could offer would be greatly appreciated.
|
|
|
|
|