Advertisement Jump to content
Sign in to follow this  

Creating a toolbar through C-API

This topic is 3828 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I made a dll that has a bunch of function. One of them creates a CFrameWnd window. Inside the function that creates my CFrameWnd, I can create a CToolBar object. However I now want the user of the dll to be able to attach a customized CToolBar object to that window (instead of the default CToolBar object that I created during window creation). So I thought I simply create the customized CToolBar object in the client application in the same way I did in the dll function. That however does not seem to work: in release mode the toolbar appears, but doesn't have any bitmap, in debug mode, I get a debug assertion error in following function of "afxwin1.inl":
	{ ASSERT(afxCurrentInstanceHandle != NULL);
		return afxCurrentInstanceHandle; }

my toolbar is created (or rather I attempt to create my toolbar) in the client application with:
	CToolBar* toolBar;
	toolBar=new CToolBar();

What can I possibly be doing wrong?

Share this post

Link to post
Share on other sites
Thank you LessBread. I had a look at CodeProject and might have found where my problem lies. I cannot test it right now but the mistake I could have done is that at the beginning of each exported dll function, I call following function:

void commonDllStartRoutine()

I didn't realize that the macro AFX_MANAGE_STATE would loose its effect at the end of its scope! (so my calls to commonDllStartRoutine() don't have any effect it seems!)

Might that be my problem?

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!