|
Check out http://www.codeproject.com/database/CppSQLite.asp
|
|
|
|
|
|
hi, I've a simple question, I've one main DialogBox that creates a second new one when a button is clicked, but the focus of application is passed to the new one dialog and the old one waits until it gets the quit from the other dialog, here's the code :
<br />
case IDC_MMC:<br />
if( bIsMmcDialogOpen == false)<br />
{<br />
DialogBox(hInst, MAKEINTRESOURCE(IDD_MMC), hwndMain ,DlgMMCProc);<br />
bIsMmcDialogOpen = true;<br />
EnableWindow(GetDlgItem(hWnd,IDC_MMC), false);<br />
UpdateWindow(hWnd);<br />
}<br />
break;<br />
and here it's the callback function of IDD_MMC
<br />
NT_PTR CALLBACK DlgMMCProc(HWND hWnd, UINT uMsg, <br />
WPARAM wParam, LPARAM lParam)<br />
{<br />
switch (uMsg)<br />
{<br />
case WM_CLOSE : <br />
bIsMmcDialogOpen = false;<br />
EndDialog(hWnd,1);<br />
break;<br />
}<br />
return false;<br />
<br />
}<br />
I need to get return to main Dialog immediatly, how to do it?
thanks
Paolo
|
|
|
|
|
Paolo Ponzano wrote:
I need to get return to main Dialog immediatly, how to do it?
Use a modeless dialog instead.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
can I create a modeless dialog without using MFC??? what api should I use?
|
|
|
|
|
Paolo Ponzano wrote:
can I create a modeless dialog without using MFC???
Sure.
Paolo Ponzano wrote:
what api should I use?
CreateDialog()<br />
CreateDialogIndirect()<br />
CreateDialogIndirectParam()<br />
CreateDialogParam()<br />
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
but for doing so, I need to have a class registered of the main window? at this time I've not got, since my program consists in a DialogBox itself... but those functions refers to CreateWindowEx to create the box, so I think I've to register one, tell me if I'm right
Thanks again
Paolo
|
|
|
|
|
The class, #32770, is already registered. All you need to supply is the template.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
i have got a icon from other program ,now i have the HICON of the icon,but if i use LoadIcon whose parameter need icon ID,do you have a good idea?
|
|
|
|
|
In OnInitDialog() :
m_hIcon = ExtractIcon(AfxGetInstanceHandle(), path_to_file_containing_icon_here, 0);
SetIcon(m_hIcon, TRUE);
SetIcon(m_hIcon, FALSE);
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
how to color menu and toolbar?
|
|
|
|
|
Do you mean instead of letting the OS do it?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
In my line of work I have times when I have to included existing code modules in with my new code. So happens this time I have an existing set of subroutines in a Fortran DLL that I need to access from my C++ Code. I can't get it to work following Microsoft's recommendations. Does anyone out there have any ideas the may work? For those of you who thing I should rewrite the Fortran in C++ it would take entirely too long to do that. I figure there are a few thousand lines of Fortran code.
Thanks,
George
|
|
|
|
|
BubbaGee wrote:
I can't get it to work...
Why not? What are the symptoms? Are the functions in the Fortran DLL exported? Are you importing them correctly in the C++ code?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
The functions in the Fortran have the following: !DEC$ ATTRIBUTES DLLEXPORT :: INITIA
and the C++ code has this: extern "C" {void INITIA(int,int,int,int);}
There are a few of these since I'm trying to access eight routines in the DLL.
Everything is compiling just fine I just get LNK2019 error messages for all the routines I'm trying to use in the C++ code.
George
|
|
|
|
|
BubbaGee wrote:
I just get LNK2019 error messages...
This must not be VS6. Correct?
Are you sure you have the correct signature for the exported function?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Correct. I'm running Visual Studio .NET 2003. I did some more searching on this site and came across an article by Shoalin Panda that may help me solve my problem. I'll let you know if it works.
George
|
|
|
|
|
Why not trying a LoadLibrary GetProcAddress sequence.
If you are able to get the function pointer, all you need afterward is to define it with the good calling convention.
To get the name of the function, try dumpbin or dependency walker
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
I don't think you are following Micro$oft's recommendations.
I just checked MSDN and it says to use __stdcall for FORTRAN functions.
For more info search for mixed-language programming in the MSDN docs.
__________________________________________
a two cent stamp short of going postal.
|
|
|
|
|
Note, you don't *have* to use a DLL for this to work. You can simply link all the stuff together. You do have to take into account different parameter passing mechanisms (e.g., C++ strings do not map to Fortran strings!) but that is the same as if you use a DLL.
I don't remember all the details, though, so I'm useless. But I think if you have a Fortran compiler that links into Visual Studio (they exist), you can do this relatively painlessly.
"Fish and guests stink in three days." - Benjamin Franlkin
|
|
|
|
|
The group I'm working on the code for wants it as a DLL so I don't have much of a choice.
|
|
|
|
|
I am new to C++. When would someone choose to use a static over a dynamic or the other way around?What exactly is the difference between to two? Thanks a lot
|
|
|
|
|
There are multiple things in C++ that can be 'static' or 'dynamic'. If none of the following match your situation, you should consider reposting and clarifying the context a little more. Like, "Where, in what context, were these words mentioned ?"
Most commonly, these two refer to the way a variable is stored in memory. When a variable is considered 'static', it is stored in the local stack memory. Each process that executes in a Win32 environment is allocated a piece of memory for it's private purposes. This memory is known as 'stack'. It cannot be directly accessed by any other application, it is private to the process in question. When a stack variable goes out-of-scope (a function where the variable was declared is finished), it is automatically destroyed and freed.
The alternative to 'static' variable is a 'dynamic' variable. At this point, the variable is stored in heap memory. This heap memory is considered all the RAM memory on your computer that is not process-specific. It is available for use by different processes. Each process can reserve a slice of this memory, use it to store a variable, and then release the memory when it is no longer needed. A heap variable never goes out-of-scope. You must manually reserve and release the associated memory. Failing to release memory will lead to memory leaks.
The actual C++ keyword, static , when used with a variable, creates a scope-independent variable. This means that when you create a static variable inside a function, and then at some point re-call this function, the variable is automatically initialized to the value it was when the last function execution ended. So to speak, the variable is not 'lost' when it goes out-of-scope.
All in all, I suggest you grab a good C++ -book and read it through with thought. C++ is quite difficult at start, but when you get a grasp of it, it becomes like a second language
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
If you are referring to the AppWizard's question about the MFC library, then it is asking if you want the MFC library completely embedded into your application or whether you want to access MFC via a DLL (Dynamically Linked Library). From a programming point of view, there is no difference.
Static linking makes the application more portable to weirdly configured machines (such as those with ancient MFC libraries or missing them altogether) but seriously increases the size of your application.
|
|
|
|
|
Hi,
I'm trying to prompt the user when he clicks close off my menubar (MFC SDI) so i set an OnFileCLose() function (using resources-tab), but when i run the program it does not enter the function, it just closes without hitting my messagebox.
i'm sure there's a very easy solution to this, if anyone has thoughts please let me know. I will owe you a coke.
thanks,
Mike
"I bet Einstein turned himself all sorts of colors before he invented the light bulb." -- Homer J.
|
|
|
|