|
Thanks this article is great.
btw, there are two accidental spaces in front of the hyperlink, so it becomes "http:/ www." instead of "http:/www.".
Just mentioning that in case anyone else uses the link.
|
|
|
|
|
The problem can be caused by a non-initialized pointer ;
in debug version the pointer might be automatically
initialized to zero by the compiler, and in release
version, the compiler does not perform any automatic
init. So, when a delete is done on the pointer, it
crashes if the pointer is not null.
|
|
|
|
|
Thanks, I will review my code for that.
|
|
|
|
|
I posted this message to the MC++ forum a few days ago, but that place is a ghost town, so I thought I'd try here
I have a C# project that needs to use a C++ SDK, so I'm trying to write a MC++ dll to act between them. At first, this was fine, but the problem is, the SDK defines a number of function pointers for callbacks. The objects I pass through complain that they are __gc type instead of type, and the pointers themselves complain that they are not __stdcall, which I assume means that the .NET stuff has it's own calling convention. However, I'm not that knowledgable when it comes to dlls, and I sure have never used MC++ before. I tried putting __nogc at the head of the class, that fixed all my errors, but gave me a new one, telling me I can't do that. What's the best way for me to proceed here ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Sorry I can’t be of any help here, I’m still not .NET enabled.
But did you ever over come the issues you where facing with the other DLL you where working with?
If so what was the resolution?
-------------------------------
DEBUGGING : Removing the needles from the haystack.
|
|
|
|
|
Not yet, I asked on a Microsoft forum, and someone gave me some advice, but not enough to get me through. I've not yet checked this morning to see if there's any more info there.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi,
I am doing a project in win32. I have two dialog boxes running at the same time. At one point I want to close on of the dialog from the dialog proc of the other.
How do I get the handle of the dialog.
Pls help.
|
|
|
|
|
If you both share the same parent window, then enumerate child windows of the parent window. If it is not you, then it must be the other dialog.
|
|
|
|
|
They dont share the same parent window...How do I do in this case..
|
|
|
|
|
If they are created from the same program, why don't you pass the handle of the first dialog box to the other via its constructor?
|
|
|
|
|
If both dialogs exist in the same thread then send message is your friend. However, if they are from different threads (separate apps) then post message is your friend.
I have always found it best to just tell (send it a custom message) the dialog that should close to do so. That way it can perform any clean up operations it needs to.
-------------------------------
DEBUGGING : Removing the needles from the haystack.
|
|
|
|
|
Ann66 wrote:
How do I get the handle of the dialog.
Opps, I missed that part when I replied earlier. If you know the caption you can use find window to get a CWnd pointer.
static CWnd* PASCAL FindWindow(<br />
LPCTSTR lpszClassName,<br />
LPCTSTR lpszWindowName <br />
);
MSDN[^]
-------------------------------
DEBUGGING : Removing the needles from the haystack.
|
|
|
|
|
I have a record list with many colomns.
Under one of the colomns, i would like to set the text color red based on some logic., but only for that particular record in that particular colomn.
I currently do something like:
COLORREF cr;
if (indicator)
{
cr = RGB(255,0,0);
m_RecordList.SetTextColor(cr);
strValue = "YES";
m_RecordList.SetItemText(i, INDICATUR, strValue);
}
Then i would set the color back to black for the next record.
This obviously does not work because when the color is changed, it changes the entire record list.
What can i use to just get that record in that column text to be red?
|
|
|
|
|
hello all, i have a question:
c# has the feature of 'static constructors' meaning that the static constructor is guaranteed to be called before any part of the rest of a class is used or instantiated. i.e. the following code:
class MyClass {<br />
private static int mydata[];<br />
<br />
public static MyClass() {<br />
MyClass::mydata = new int[20];<br />
}<br />
<br />
public static doSomething() {<br />
}<br />
}
before DoSomething is accessed, the test() static consturctor is guaranteed to be called. any equivalent of this in c++ ? (alternative to doing everything in the WinMain() or the _main()
|
|
|
|
|
|
#pragma once
class DoMuie
{
public:
DoMuie(void);
~DoMuie(void);
static int MuieYesOrNo(void);
};
#include ".\domuie.h"
DoMuie::DoMuie(void)
{
}
DoMuie::~DoMuie(void)
{
}
int DoMuie::MuieYesOrNo(void)
{
DoMuie(); //static function calling class constructor
// you can decalre static variables in constructor to do.... muie
return 0;
}
|
|
|
|
|
That's not even close to what he wants.
Good music: In my rosary[^]
|
|
|
|
|
LOL - I stared at it for a while, and just assumed my C++ was too rusty, because I could not see how it helped
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
No, but this[^] article explains how to emulate static constructors in C++.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Aside from creating an elaborate framework, or initializing all globals/statics in an init function your only real option is through the use of #pragma init_seg().
The pragma specifies when the global/static variables in a source file (.c/.cpp) are to be initialized. There are 3 defined groups: compiler, lib, user that are initialized in that order.
e.g.
Given (in various .h files):
extern int g_a;
class C {...}; // uses g_a
extern C g_c;
fileA.cpp (source with g_a):
#pragma init_seg(lib)
int g_a = 0;
fileC.cpp (source for class C):
#pragma init_seg(user)
C g_c();
Normally it would be a crap shoot on whether g_a is initialized before g_c.
However, with the pragma's, the compiler will make sure g_a = 0 before g_c is constructed.
...cmk
Save the whales - collect the whole set
|
|
|
|
|
|
Is there a basic windows dialog we can use when making an application that has a "Browse...", "Open...", or "Save..." option, or do I have to create my own? How would I use it, if there is one provided for me already?
Danny
|
|
|
|
|
|
How about GetOpenFileName() or SHBrowseForFolder() ?
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|