|
Just a silly idea (I've no means to test it now): why don't you run the preprocessor (compile with /E option) then use the output as your source file?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Used the /P option and cut and paste the output and commented the macro
thankx
|
|
|
|
|
Hi.
I have a little problem's (I hope!).
I must call a VC++ (6.0) DLL with a dialog from a VB program.
I have try to call a MFC Extension DLL (create in vc++ 6.0) but when the VB program call my DLL crash.
Can you help me??
Thank's a lot from everybody.
Patrizio
Hi! I'm very happy to talk with everybody about VC++.
|
|
|
|
|
Lazzari Patrizio wrote: but when the VB program call my DLL crash
does it give you any error messages ?
also note that VB6 requires that DLLs use the 'stdcall' calling convention. if your functions aren't exported using stdcall, you will get an error.
modified on Thursday, January 14, 2010 11:51 PM
|
|
|
|
|
Lazzari Patrizio wrote: I have try to call a MFC Extension DLL (create in vc++ 6.0) but when the VB program call my DLL crash.
I don't think you can use an MFC extension DLL from a VB program. You could build an use an MFC extension DLL only if the client program (the one that loads and executes code from the dll) is also an MFC program.
I recommend that you rebuild the DLL as a regular DLL (MFC can be used within, but the DLL should not be built as an extension DLL) and try using it from your VB program.
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
Can i change my project from MFC Extension DLL to regular DLL or i must create a new project? Thank's
Hi! I'm very happy to talk with everybody about VC++.
|
|
|
|
|
As long as you are not throwing around MFC objects between functions (back and forth the DLL and client), just changing the settings should suffice. Because that would be possible only when an MFC extension DLL loaded by an MFC program.
Also, remember what the other responder said about calling conventions while exporting functions from the DLL.
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
Hi All,
I am developing an application which uses directx apis to render a 3d image.
I want to use .Net framework.Which one of the below languages is good for doing that.I am pretty new to .net.I may seek some coding help from internet.
1.)VC++.Net(Form based application)
2.)Vb.net(Form based application)
3.)C#.net(Form based application)
Please adivce,
Ashwath.
|
|
|
|
|
you've already posted this under [.Net Framework] which since you say you want to use .Net is likely the best forum. Dont cross post please, its bad form and you'll get snarled at and possibly not even an answer to your question in any forum
'g'
|
|
|
|
|
Hi all,
I have made a SDI application in that application i have made a tree ctrl and its class derived from CTreeView. But my problem is when in OnInitialUpdate i write this piece of code
HRESULT hres;
hres = CoInitializeEx(0, COINIT_MULTITHREADED);
if (FAILED(hres))
{
AfxMessageBox(_T("Failed to initialize COM library") );
return ;
}
it returns a error
hres 0x80010106 Cannot change thread mode after it is set.
how can i resolve this
thanks in advance
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
Looking at the documentation here[^] may help. I think your CoInitializeEx() call is occurring more than once, in which case calls after the first will receive S_FALSE even though the call is valid. It may be better to move the call to the beginning of your application.
MVP 2010 - are they mad?
|
|
|
|
|
Actually he is getting RPC_E_CHANGED_MODE , probably one of the loaded DLL s of his application already called the function specifying a different threading model.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Once again, foolishly, I assumed he had already checked the return code and determined this was not the case.
MVP 2010 - are they mad?
|
|
|
|
|
Hi guys,
Looking for some help..
In my current assignment, its needed to hide all the Dockeble panes and to get them back as they where before hiding. during hidden period, they should not be visible/available to the user. it is some how like closing the project and opening a new project in the Visual studio IDE.
However it is working fine with al the panes until they are not in the AutoHide mode. to resolve the issue, i first set Checked the Auto Hide state, if its true, then i set it to false.
Now as on getting back i want to turn the pane back in the Autohide state, i set it by calling the function:
SetAutoHideMode(TRUE, CBRS_ALIGN_ANY);
but then the application crashes
Here is the snap of the code to clear the problem: -
To Save the state, i did this:-
pPane is the pointer of the CDockablePane
m_nState = 0;
if(pPane->m_hWnd)
{
if(pPane->IsDocked() && pPane->IsAutoHideMode())
{
pPane->ToggleAutoHide();
m_nState = 1;
}
else if(pPane->IsVisible())
{
m_nState = 2;
}
pPane->ShowPane(FALSE, FALSE, FALSE);
}
To Set the previous state i did this:-
Here since i have passed the pointer with CPane
if(m_nState == 0)
{
return;
}
pPane->ShowPane(TRUE, FALSE, TRUE);
if((m_nState == 1) && pPane->IsDocked() && !pPane->IsAutoHideMode())
{
pPane->SetAutoHideMode(TRUE, CBRS_ALIGN_ANY);
}
And then It calles crash at BOOL CDockablePane::CheckStopSlideCondition(BOOL bDirection).
HARSH
Programmers are in a race with the Universe to create bigger and better idiot-proof programs, while the Universe is trying to create bigger and better idiots. So far the Universe is winning.
|
|
|
|
|
Hi,
Have a doubt, will virtual destructor work only when u create objects thru heap ??? Bcoz the following code works either way with or without virtual destructor .
class A
{
int *p;
public :
A() {p = new int;
*p = 10;}
~A ()
{
delete p;
p = NULL;
printf("this is A dest \n");
}
virtual int getVal()
{
if(p)
return *p;
return 0;
}
};
class B : public A
{
int *p1;
public :
B() {
p1 = new int;
*p1 = 10;
printf("this is B dest \n");
}
~B ()
{
delete p1;
p1 = NULL;
}
int getVal()
{
if(p1)
return *p1;
return 0;
}
};
int main(int argc, char* argv[])
{
B b;
A *ap = &b;
ap->getVal();
//But virtual destructor works when u do thru heap
//B *pb = new B;
//A *ap = new B;
//delete pb;
//delete ap;
return 0;
}
Here when objects goes out of scope , both destructors getting called irrespecive of virtual. So virtual destructor works only with heap ?
|
|
|
|
|
There's nothing strange in that: when b goes out of scope, its destructor is called (as well its base class one). b type is know at compile time.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
You've got your printf("this is B dest \n"); in the constructor for the B class, instead of the destructor.
|
|
|
|
|
You *need* a virtual destructor when you could possibly be destructing an object of type B through a pointer or reference of type A.
But virtual destructors can *always* be used in place of non-virtual destructors, whether objects are allocated on heap or stack.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
MVP for 2010 - who'd'a thunk it!
|
|
|
|
|
hey, so virtual destructor wont work if u the objects created at stack ? Bcoz in my example , A::destructor is called bcoz B is going out of scope. If my statement wrong can u pl give me sample with objects created in stack to test Virtual destructor.
thanks
|
|
|
|
|
Remember that B's destructor will call A's destructor...once it's finished any of your code in B's destructor. That is why A's destructor is being called.
Oh - and also, you won't see if B's destructor is called, because your print statement is in B's CONSTRUCTOR, not B's DESTRUCTOR!
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
MVP for 2010 - who'd'a thunk it!
|
|
|
|
|
hi thanks,
(Ya i was put inside constructor by mistake - )
I understand that when B goes out of scope, A's destructor also called . But is there a way to see that virtual destructor is called for objects created at stack .
thanks
|
|
|
|
|
I really don't understand what you mean.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
MVP for 2010 - who'd'a thunk it!
|
|
|
|
|
I mean in my example,
int main()
{
B b;
A *ap = &b;
ap->getVal();//when B object goes out of scope, B's desc is called first then A's (here its not thru virtual destr)
//here i see virtual destructor is called ,(ie B'destc first then A's destr )
A *pb = new B;
delete pb;
}
So here i m trying to see B's destr called thru virtual destructor concept.
|
|
|
|
|
Virtual destructors are exactly the same as non-virtual destructors, except that a virtual destructor is included in the classes virtual function table (v-table).
All this means is that with a virtual destructor, a pointer to A will look for the correct destructor to call in the class's v-table. Without a virtual destructor, a pointer to A will not do this - it'll directly call A::~A.
With objects on the stack, this can never happen, because the compiler never deallocates the object through a pointer - it always destructs the actual object directly. This means that an object on the stack never has to look at its v-table to determine which destructor it should be calling.
What I'm basically saying is - the question you're trying to answer is meaningless.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
MVP for 2010 - who'd'a thunk it!
|
|
|
|
|
After using VC6++ for years I just purchased VS2008. It is radically different and I am quite confused. Is there a good tutorial or book that will teach me how to use MFC for this version. I don't want to use any of the managed code stuff or C#. I want to be able to do the things that were simple in VC6++.
For instance, put "This is a test in a ListBox". That was simple with VC6 and MFC. Four hours into VC++ 2008 and I haven't been able to get that to happen. In VC6 you could add a CString variable to a ListBox. There is no CString ListBox variable option for VC++ 2008.
Also, Class Wizard in VC6 allowed me to see any variable that had been assingned to a control. And Class View also allowed me to see all the variables that had been created for the project. Apparently neither one of the options are available in VC++ 2008. Class View doesn't show any control variables. In fact it doesn't show much of anything. And since I can't see the variables there appears to be no way to delete one once it is assigned to a control.
I do see the variables listed here:
CHIDTest2008Dlg::CHIDTest2008Dlg(CWnd* pParent /*=NULL*/)
: CDialog(CHIDTest2008Dlg::IDD, pParent)
, m_strText(0)
, m_ListBox(0)
, strListBox(_T(""))
, m_strListBox2(0)
{
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
But that is really of no use. And the online help is not much help. Am I missing something basic here or is this the way the environment really works. Was Microsoft trying to move everyone to managed code or C#?
Again, if anyone has a recommendation for a good book that only covers the MFC part of VS2008 I would appreciate them passing that along.
|
|
|
|