|
hmmm, that did not seem to work. I can not pass it the value of Null. It returns the following error:
error C2512: 'CDocTemplate' : no appropriate default constructor available
Plus I want to actually pick which document templat opens. I have three, and I want a specific one to open.
Any other suggestions or maybe you could refer me to where you read that at.
|
|
|
|
|
Sounds like you need to make use of the undocumented MFC class CDocManager. When you call AddDocTemplate() in InitInstance(), the template pointer is handed off to the m_pDocManager object, which is part of your CWinApp object. You can use this to iterate the CDocTemplates registered in your application and call OpenDocumentFile(NULL) on your CMultiDocTemplate object.
This should create an empty document of the required type.
See MFC files DOCMULTI.CPP line 114 and DOCSINGL.CPP line 88 for the functions in question.
Roger Allen
Sonork 100.10016
WHats brown and sticky?
A stick or some smelly stuff!
|
|
|
|
|
Hi,
I have some ownerdraw listbox controls with custom background color. All works well, but on Windows XP they show a white border (1 pixel thick around client area, the middle is painted with my custom backgound). Looks really ugly and I dunno what I'm doing wrong...
I have this on XP only (default desktop theme), not on Win9x. Can anyone help?
Thanks for feedback, Moak
|
|
|
|
|
You can turn off themes for the control, to go back to the pre-XP behavior.
SetWindowTheme ( hwndList, L"", L"" );
--Mike--
Looks like I picked the wrong week to stop sniffing glue.
1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
Is there another possibility? perhaps I'm doing something wrong and causing the white border by wrong WinAPI use?
basically, I like to use themes, e.g. XP scrollbars look nice and I also want to respect the user's look&feel.
Greets, Moak
|
|
|
|
|
Hi,
U can use CRecordset class for doing things related to database like adding update and delete. First u have to create DSN and create a new class with CRecordset as the base class and proceed with creating a pointer to the object.
Try that.
Satya
|
|
|
|
|
That time has come again where I have a project that I have to document for a government cutomer. Currently my company doesn't have any tools for generating documentation and I have been investigating what is out there.
I haven't found any tools that could even help as most of them just give you the most basic of info like all the class names.
If you have any good tools that I might try please let me know.
Also, I'm thinking about coming up with my own tool and would like to try and get a bunch of the pieces from code that is already out there...any ideas on a good app to start from or modules I could use to get a good start on this?
Thanks,
Jim
|
|
|
|
|
A lot of people like the tool that this[^] article shows how to use.
Chris Richardson
Programmers find all sorts of ingenious ways to screw ourselves over. - Tim Smith
|
|
|
|
|
Chris, Thanks for the link. That is a pretty good tool, would have been more useful it I would have known "how" to document my code in its standard (like most of the tools that I have found).
I think I'm going to use it and as time goes by my code should get up to speed with it.
Again, thanks.
Jim
|
|
|
|
|
Hi,
I've been working on this one for some days now and I'm all out of ideas.
My program works just fine when it is build for debug, but when I build it for release it crashes at some point. Now, when I tried to analyze the crash dump information, I saw that the callstack got corrupt so I can't do anything with it. I've tried using BoundsChecker on both the release and debug exe but it doesn't report anything (except for the access violation of course...)
My next idea was to add some logging (to a file) in my program so I could trace where exactly I was going in my code. The problem now is that by adding code for logging purposes I'm changing the stack of my program so that again it doesn't crash anymore.
I have been able to make up in which function the crash occurs, but placing logging inside that function "prevents" the crash...
I hope there is someone out there who has run into a similar problem and was able to solve it.
Any ideas are welcome
greetz
Don't think you are, know you are...
|
|
|
|
|
If you spotted the offending function, then you're nearly at it. Try posting the code here, maybe someone can see the error.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
You are probably trashing a stack array. Maybe a character string or some such thing. You might also be returning a pointer to a stack variable. This can cause all sorts of strange problems.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
The first thing to check is that all you modules use same CRT model (lets say /MDd) "Project settings->C/C++->Code Generation->Runtime Library" page.
The second is to debug. When stack gets corrupted it is easy to see in debug right the way (assuming you know the approximate location.
|
|
|
|
|
|
Tell me please, how can i read mail from Yahoo's (or from the same web mail systems) by my own desktop application (without direct loggin-ing into the WEB-page)?
Thank You !
regards.
|
|
|
|
|
What will happen if the following case happen:
I started an timer-driven event like this, if A_long_call() can't return within TIMESLICE==1 millisecond, what will happen? The following is what I understand, is it correct?
*** below is My understanding*****
Time axis(in millisecond):
1--------------2------------3-------------4-----------5----------
controller()_______ controller()________
***above is My understanding****
timeSetEvent(TIMESLICE, wTimerRes, (LPTIMECALLBACK) TimerFunc, 0, TIME_PERIODIC);
//here is the functions
void CALLBACK TimerFunc(UINT timer_id, UINT msg, DWORD dwUser, DWORD dw1, DWORD dw2)
{
if (timer_id == 0)
return;
controller();
}
controller()
{
A_long_call();
}
|
|
|
|
|
What will happen if the following case happen:
I started an timer-driven event like this, if A_long_call() can't return within TIMESLICE==1 millisecond, what will happen? The following is what I understand, is it correct?
*** below is My understanding*****
Time axis(in millisecond):
1--------------2------------3-------------4-----------5----------
controller()_______ controller()________
***above is My understanding****
timeSetEvent(TIMESLICE, wTimerRes, (LPTIMECALLBACK) TimerFunc, 0, TIME_PERIODIC);
//here is the functions
void CALLBACK TimerFunc(UINT timer_id, UINT msg, DWORD dwUser, DWORD dw1, DWORD dw2)
{
if (timer_id == 0)
return;
controller();
}
controller()
{
A_long_call();
}
|
|
|
|
|
Hello i am wondering about the following things because i'd like to get an idea about a source code is related to the final EXE
Let's say we have a class (i am working with VC7, assuming no optimizations at all)
class CMyDlg : public CDialog
{
// Construction
public:
CMyDlg(CWnd* pParent = NULL); // standard constructor
... // data
int d1, d2, d3;
CString s1, s2, s3;
...
... //methods
void method1 (int v1);
void method2 (int v2);
...
};
// Implementation for the CMyDlg Class
...
CMyDlg::CMyDlg(CWnd* pParent /* = NULL*/)
: CDialog(CMyDlg::IDD, pParent)
{
d1=100;
d2=200;
d3=300;
s1="default";
s2="";
s3="hello";
}
void CMyDlg::method1( int v1)
{
// do something
...
}
void CMyDlg::method2( int v2)
{
// do something
...
}
well, imagine to compile and get the EXE.
Some questions:
1) If, for refactoring purposes i decide to rename the class into something like CMyOtherDlg, and leave everything else unchanged (data and methods), the resulting compiled code inside the EXE will be exactly the same?
2) What about changing also the members and methods names?
3) If i change (just for example) the declaration order and/or the inizialization order for the variables, will this 'matter' something or will have completely no influence on the final EXE?
4) Do the names used inside the source code mean 'something special' in the final EXE? Why, for example, if i examine the resulting EXE code, with an HEX editor i am able to find some MFC or API functions names and not the names of my functions/classes (at least it seems so to me)?
Any info about the above will be greatly appreciated, as well as any web links helpful to understand (even from a general point of view, let's say an overview) about how the VC compiler 'translates' the source code, links it and finally produces the EXE.
thanks in advance!
best regards
|
|
|
|
|
1) In release mode, seems the name does not appear in the final .EXE.
2) Same answer
3) It affects the layout of the objects, and hence the final .EXE.
4) This is due to the fact that those names are used to dynamically link the appropriate methods at startup.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
1) No, there generally shouldn't be any change to the exe (if you build in debug mode then you may see a few name changes, but thats all)
2) Same as above. The names of classes and functions are just symbolic - they all get stripped out when compiled (also again dependant on debug/release)
3) It can matter, depending on the byte alignment. For example, if you have:
char m_MyChar;
int m_MyInt;
char m_MyChar2;
And
int m_MyInt;
char m_MyChar;
char m_MyChar2;
The second version will be slightly more space efficient. The first m_MyChar will be byte aligned and so take up 4/8 bytes (I cant remember the exact value), of which only 1 byte is used. Then the int, then a 4/8 byte for the second char. Total is 12 (using 4 byte align, and 4 byte int). The second has 4 bytes for the int, and 2 bytes for the char... aligned as 4 bytes, so total is 8
|
|
|
|
|
to 3)
Another thing: If you try to save this class by serialisation the order will also be changed, so the files produced by the different .exe would be different.
|
|
|
|
|
Hy everybody!
I Have an CRichEditCtrl, and I'm using CHARFORMAT to add String s on it. Whem I run the program in Win2K, no problems, the SetSelectionCharFormat works fine, but when I run over Win9x the RichEdit doesn't work good.
I need some help folks
thanks all for your attention!
cheers!
Ricky
|
|
|
|
|
for 95 watch for "Requires Rich Edit 2.0 or later on Windows 95" in MSDN
|
|
|
|
|
Anyone knows how to calculate or retrieve the "Commit Peak" value as shown in the TaskManager?
On WindowsXP I can get the value with GetPerformanceInfo() but what about W2k and NT4 ??
Holy Sh*t! I'm speechless. (hey, that's a first) Marc Clifton, The Lounge
|
|
|
|
|
hello,
I would like detect when the key "Ctrl" is down and show a dialog box at this time, and hide the dialog box when the key is up.
You know how can i do this?
Thx
|
|
|
|