|
My thoughts are that you did not initialize something in your first version properly but you were lucky that it did not cause a problem.
John
|
|
|
|
|
That may be the case. I started a new empty project and slowly added in all my files and checking for things like uninitialized variables. It works fine again. I really did not change much beside using a new empty project. Thanks for your responses.
|
|
|
|
|
smesser wrote:
So what is a good approach for separating common files like in my situation?
Exactly what you did. You can also seperate each part (execpt for the main application) into is own library or dll.
John
|
|
|
|
|
The plugin is a dll I need to learn how to put common into a dll. Can you point out a good article?
|
|
|
|
|
My help files are split in 4 .chm (one master, linking to others)... I want to search topic by ids without the user know that the topic doesn't come from the main .chm ?
I used
HtmlHelp(GetDesktopWindow(), HelpPath, HH_DISPLAY_TOC, id);
when I had only one .chm
but now I don't have an idea how to do the same!
thanks
|
|
|
|
|
I am trying to wrap a C API in C++. The problem I am having is that some of the functions in this API are callbacks. When I create functions in a C++ class the calling convention is __thiscall. From each function I created I called the corresonding C function from the API. The problem is that the C function uses the __cdecl calling convention. I get an error when trying to compile
cannot convert parameter 2 from 'void *' to 'void (__cdecl *)(void *)'
Ex.
// this is the callback
void CTest:: Error(void *Param)
{
}
CNew new; // in the CTest class
new.AppCatchError(Error) //this is within the CTest class
void CNew::AppCatchError(void* HandlerFunc)// HandlerFunc a c++ member function
{
//this is the C API function
AppError(HandlerFunc); //error this is looking for a c function __cdecl
}
|
|
|
|
|
If you pass a function pointer along with another function, you need to create a typedef of it's "signature" sorta say.
it'd be something like this:
typedef void (__cdecl *FuncPtr)(void *);
This basically defines a generic function signature, with C declaration and one void ptr argument.
And now use FuncPtr as argument for AppCatchError in order to be able to pass Error() along as a pointer.
Hope this helps.
If you're interested to know more about it, check this out
|
|
|
|
|
Still geting an error
cannot convert parameter 2 from 'void (__cdecl *(void))(void *)' to 'void (__cdecl *)(void *)'
This has to do with the fact that it is a member function. How does this work in C++, if this function was global function there wouldn't be a problem.
|
|
|
|
|
You can do three things:
1) Make the function global
2) Make it static
3) Wrapper functions
|
|
|
|
|
gs1589 wrote:
This has to do with the fact that it is a member function.
Yes, it does. If you want to use it this way the member function must be a static member function.
John
|
|
|
|
|
Error(void *Param) is a member function. Make it static.
// this is the callback
static void __stdcall CTest:: Error(void *Param);
Kuphryn
|
|
|
|
|
Hi,
I have a couple of list views in which I use Custom Draw to get my content on screen. This all works just fine, except for one thing. The uItemState member of the NMCUSTOMDRAW structure is supposed to indicate whether an item is selected or not.
I would test it like:
if( pNMCD->nmcd.uItemState & CDIS_SELECTED)
{
}
Except that always ends up being true, even when an item is not selected. So, right now I'm testing the MFC way with GetItemState, and test for the LVIS_SELECTED bit. But am I just using uItemState in a wrong way or anything? Everywhere I look at on the web it's used in such way..
It's not a big thing, I mean, GetItemState does the job. But I am getting curious why it won't work for me.
|
|
|
|
|
uItemState is only valid for certain draw stages, as specified by the uDrawStage member of NMCUSTOMDRAW .
Software Zen: delete this;
|
|
|
|
|
I want to create CBitmapButton in a dialog with CButton::Create(), but for some reason the button is not visible when I run the app.
I put the following code in CDialog::OnInitDialog()
<br />
VERIFY(m_whiteBtn2.Create("", WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON | BS_OWNERDRAW, CRect(200, 100,85,48), this, IDC_WHITE_BUTTON2));<br />
<br />
VERIFY(m_whiteBtn2.LoadBitmaps(IDB_WHITE_BUTTONU, IDB_WHITE_BUTTOND));<br />
Does anyone know what might be the problem?
|
|
|
|
|
You might want to try BS_BITMAP ...
Iain.
|
|
|
|
|
|
I've already made it work by using AutoLoad(), but I'm having problems with using CButton::Create().
|
|
|
|
|
In case you don't get your code working, see this article.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
After calling the button's Create(...) method, you must call its ShowWindow(SW_SHOW); method to actually show the window.
Software Zen: delete this;
|
|
|
|
|
hello again,
once an application has been compiled, you can pretty much delete the source code and it will work fine.
how about if i need to get the code for a certain application back - i deleted it by accident.
how can i get the code behind a compiled working application.
thanks for you help guys
g.r.
|
|
|
|
|
Source Control.
Or, perish the thought, maybe even Back Ups.
But in your case, I suspect these aren't going to be suitable.
Chris Meech
We're more like a hobbiest in a Home Depot drooling at all the shiny power tools, rather than a craftsman that makes the chair to an exacting level of comfort by measuring the customer's butt. Marc Clifton
VB is like a toolbox, in the hands of a craftsman, you can end up with some amazing stuff, but without the skills to use it right you end up with Homer Simpson's attempt at building a barbeque or his attempt at a Spice rack. Michael P. Butler
|
|
|
|
|
I'm not sure about other languages apart from C++, but compilation is a one way process. There is no undo process.
There are programs that allow you to build messy assembly language interpretation of a given EXE file, but the 'original' source code used to build the program is unobtainable.
Why in god's name would anyone want to build an app, then delete the source code anyway, especially if future fixes may be necessary?
I Dream of Absolute Zero
|
|
|
|
|
thanks for your thoughts anyway
|
|
|
|
|
RChin wrote:
Why in god's name would anyone want to build an app, then delete the source code anyway, especially if future fixes may be necessary?
It's kind of like that old George Mallory "Why did you climb the mountain? Because it's there" adage.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
I'm not a Mallory personality then. I still have source listings and floppies from my first excursions into programming (Z80 assember and DBAS12 BASIC from an RML-380Z microcomputer), as well as everything in between. I learned very quickly about 'backup' and source control, which has saved my behind on a couple of occasions.
Steve S
|
|
|
|