|
I've written a few apps that had a *LOT* of code in OnDraw. I abstracted out parts of the code into their own functions, placed this functions into their own file, and placed comments in the OnDraw function pointing to the new file. This allowed me to keep the OnDraw function to a sane size, but still allowed compartmentalizing
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Is there substitute for this funtion.
I need to output a string centered vertically,and I also want the string to be breaked if it is too long.
How can I solve this problem in a simple way?
Thanks in advance.
Wayne Wang
|
|
|
|
|
Add DT_SINGLELINE to the format specifier.
cheers,
Chris Maunder (CodeProject)
|
|
|
|
|
If I add DT_SINGLELINE to the format specifier the string will not break.It seems that DT_VCENTER takes effect only when it is used with DT_SINGLELINE. How can I center breaked string vertically in rectangle just like MicroSoft Excel does?If you find a method to this problem,please share it with me.
Thanks again.
Wayne Wang
|
|
|
|
|
If your text string has newline characters ("\n") in it, it will work fine with DT_VCENTER.
|
|
|
|
|
Hi,
I am currently trying to create a windows-based application in order to compile different projects !
To do so, the user need to select the project he wants to use, and I should then get the latest code from the SourceSafe database and compile it by using nmake in a Createprocess command.
But, unfortunately, when doing so, nkmake only create vc60.idb and vc60.pdd and nothing else.
I know nmake is working because when using it from a DOS windows, I could build my project by typing :
namke /f hfplayer.mak
Here is how I do use the createprocess :
PROCESS_INFORMATION ProcessInformation;
STARTUPINFO StartupInfo;
DWORD dwError;
BOOL bfProcess;
memset(&StartupInfo,0,sizeof(StartupInfo));
StartupInfo.cb = sizeof( StartupInfo );
StartupInfo.lpReserved = NULL;
StartupInfo.lpDesktop = NULL;
StartupInfo.lpTitle = NULL;
StartupInfo.dwFlags = STARTF_USESHOWWINDOW;
StartupInfo.wShowWindow = SW_MAXIMIZE;
StartupInfo.cbReserved2 = 0;
StartupInfo.lpReserved2 = NULL;
memset(&ProcessInformation,0,sizeof(ProcessInformation));
char szCmdLine[256] ;
sprintf(szCmdLine,"nmake.exe /B HFPlayer.mak" ) ;
bfProcess = CreateProcess(NULL,szCmdLine,NULL,NULL,FALSE,0,NULL, "D:\\My Documents\\My Dev\\HFPlayer",&StartupInfo,&ProcessInformation );
Anyhelp would be welcome !
Thanks !
|
|
|
|
|
I have a CFrameWnd derived class which I called CFrameWndEx. If I implement MFC functions (default onclose, ondestroy etc) the class derived from mine works fine and they are used automatically in case i will not override them. (I am not so good in english but trying to explain at my best). But when I try to add my own functions , for example OnHelpSearch or something like that with my own command IDs(not default MFC ones like ID_APP_ABOUT) and also add theit updatecommandUI the class derived from mine does not handle them (I forgot to mention that my class is being comiled into lib so I use import) and menu items and etc. are disabled. How can I solve that ?
Kratz
|
|
|
|
|
I have a small library extending MFC classes usin MFC 4.2. But now C++.NET is coming. Can I compile with NET my lib to use MFC4.2 or 7.0 when needed or I should make 2 different versions of my library ?
Kratz
|
|
|
|
|
Question:
I wanna get a array of string, but I am not sure the dimension of the array.
like this:
int caller()
{
char **Results=new char*[100];
myfunc();
...
}
then
int myfunc(char ***Results)
{
char* resutl0 =(char*) malloc(100);
..
char* resutl1 =(char*) malloc(200);
...
char* resutl2 =(char*) malloc(300);
...
(*Result)[0] = resutl0 ;
(*Result)[1] = resutl1 ;
(*Result)[2] = resutl2 ;
...
}
after finished some code, i wanna free the memory. so, how can i do?
1.
free(result0);
free(result1);
free(result1);
free(Results);
??
2. GlobalFree(Results)
??
3 ??
Thanks.
Code is still code.
|
|
|
|
|
Your method 1 is the right one. By the way, it should be Result[0]=result0 , without your extra * .
If you can afford it, I suggest you forget about char ** s and use vector s and string s instead, like this:
std::vector<std::string> Results(100);
...
Results[0]="Hi dude";
... Automatic cleanup, no worries about getting your strings out of bounds, etc. Give it a try.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
How do i implement multiple views that use the same document in an SDI application
Thanks, Delvi
|
|
|
|
|
|
Thanks , I'll be sure to check them all out. There must be atleast one sample i can use!!
|
|
|
|
|
Hi,
In one dialog based application, i showed a bitmap image. Now i want to
change the rgb color of pixels in the special area. I hope that where the mouse
moved to where the color will be changed. Is it possible or not?
Would you please send me some code or ideas about how to control the mouse move and set the bitmap image window?
Thanks in Advance!
chen
|
|
|
|
|
Hi
Except Windows Time, there are only icons in the taskbar's status area. Sure, the only functions to access it seems to be Shell_NotifyIcon.
But is there a way to add small text or non standard width icon (i don't find any thread speakking about this) ?
Thanks for help.
|
|
|
|
|
I can Set the receive buffer size to 400k(use setsockopt())under Win2000.
but why can't under win98(getsockopt() return is 65280byte),How to solve!
Thanks very much!
|
|
|
|
|
I might be wrong but Win98 seems to have a lot of 64 KB restrictions. And this might be one of them.
Perhaps there is a workaround. But my guess is people would advise you to forget about 98.
Regards
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
Nish is a BIG fan of Goran Ivanisevic
|
|
|
|
|
Thanks for reply!
but it seemed that I may change the restriction with regedit!
Could you tell me!
|
|
|
|
|
Hello,
in my CFormView class, I want to draw something on the dc AFTER the controls are drawn.
Does someone know which method calls RedrawWindow or UpdateWindow (which call OnPaint())?
Thank you
Yann
|
|
|
|
|
I think this is not unique error message from my compiler but can some one tell me what is wrong when a message like this appears!?? HEEEELP!!
Compiling...
ReminderSEDlg.cpp
C:\Program\Microsoft Visual Studio\MyProjects\Reminder Special Edition\ReminderSEDlg.cpp(22) : error C2370: 'THIS_FILE' : redefinition; different storage class
c:\program\microsoft visual studio\myprojects\reminder special edition\configdlg.cpp(12) : see declaration of 'THIS_FILE'
Error executing cl.exe.
Reminder Special Edition.exe - 1 error(s), 0 warning(s)
------------------------------
CodeCracker - That's me!
------------------------------
|
|
|
|
|
It means the compiler has already found a definition fo THIS_FILE. Either it is defined in more than one place or you need to ifdef it out...
x.h
#ifndef x.h
// This will only be compiled once no matter how many times it is referenced.
#define x.h
#define THIS_FILE something
#endif
Thanks for the help,
Bill
|
|
|
|
|
It means the compiler has already found a definition fo THIS_FILE. Either it is defined in more than one place or you need to ifdef it out...
x.h
#ifndef x.h
// This will only be compiled once no matter how many times it is referenced.
#define x.h
#define THIS_FILE something
#endif
Hope this helps,
Bill
|
|
|
|
|
In addition to what Bill said, most of the code I deal has this little section near the top :
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif // _DEBUG
|
|
|
|
|
Hello,
I have created a dialog type app(called "A")and a dialog type wizard (Property Page type of wizard) (called "B") to be used with in dialog "A"..
I am having problems pulling string information from previous pages of the wizzard before the wizard dialog is destroyed. Im a newb to property pages, any ideas on how I can pull the string info that the user inputs into the wizard before its closed/finished?
Thanks,
Rob
|
|
|
|
|
Create member variables in your dialog class. Store the data you wish to access in the member variables. After the DoModal call returns, the dialog object still exists. You should be able to access its public members and methods just like any other object.
Hope this helps,
Bill
|
|
|
|