|
In addition to Iain's reply, have you exported the two functions? If you are calling GetProcAddress() , what does it return?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
actually the return value was a mistake occured while type.... ill send you the sample code of how i tried to create the dll..it is as follows
//MY APPLICATION FILE
//----------------------------------------------
#include <windows.h>
typedef UINT (CALLBACK* LPFNDLLFUNC1)(VOID);
typedef UINT (CALLBACK* LPFNDLLFUNC2)(LPCSTR);
HINSTANCE hDLL;
LPFNDLLFUNC1 MyFunc1;
LPFNDLLFUNC2 MyFunc2;
UINT uReturnVal;
int main() {
hDLL = LoadLibrary("C:\\sample1.dll");
if (hDLL != NULL)
{
MyFunc1 = (LPFNDLLFUNC1)GetProcAddress(hDLL,"MyDLLFunc1");
MyFunc2 = (LPFNDLLFUNC2)GetProcAddress(hDLL,"MyDLLFunc2");
if (!MyFunc1 || !MyFunc2)
{
//Show error message
FreeLibrary(hDLL);
return false;
}
else
{
uReturnVal = MyFunc1();
uReturnVal = MyFunc2("HELLO WORLD!");//GETTING AN EXCEPTION HERE…..IT IS CALLING THE FUNCTION IN THE DLL BUT AFTER THAT THE EXCEPTION OCCURS
}
}
return true;
}
//----------------------------------------------------------------
//MY DLL CREATION FILE
//-----------------------------------------------------------------------
// sample1.cpp : Defines the entry point for the DLL application.
//
#include "stdafx.h"
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
return TRUE;
}
int MyDLLFunc1() {
MessageBox(NULL,"My DLL Function 1","",MB_OK);
return true;
}
int MyDLLFunc2(char *TEXT) {
MessageBox(NULL,TEXT,"",MB_OK);
return true;
}
//------------------------------------------------------------------------
//MY DEFINITION FILE
//------------------------------------------------------------------------
LIBRARY sample1
DESCRIPTION This is my DLL file!
EXPORTS
MyDLLFunc1 @1
MyDLLFunc2 @2
//comments
//the error is generating after this line uReturnVal = MyFunc2("HELLO WORLD!");
can you help me out
|
|
|
|
|
mismatch of calling convention __stdcall in function declaration in exe and possibly __cdecl in the dll. use dll to use __stdcall by default. or always use same prototype for DLL and exe use a common declaration with header files.
"typedef UINT (CALLBACK* LPFNDLLFUNC2)(LPCSTR);" in exe
#define CALLBACK __stdcall // note this.
while "int MyDLLFunc2(char *TEXT)" in dll; // calling conversion possibly differs.
the return type and arguments are different though they are not the cause here.
|
|
|
|
|
Check your calling convention
use:
__stdcall int MyDLLFunc1(){}
__stdcall int MyDLLFunc2(char* text) {...}
BTW: not an issue but it's better to have: __stdcall int MyDLLFunc2(LPCSTR text){}
Pass string as constant if you don't plan to modify it.
God bless,
Ernest Laurentin
|
|
|
|
|
how do i display a value on top of the screen.
i have a picture box.. and there is a picture on the picture window. now on the picture i need to show a value but this control has to be transparent. how can i achieve that?
i hope its understood..
the background has to be seen. that is the main idea.
|
|
|
|
|
did you try to display the required text on the picture control using its device context?
please try it as follows.
(m_pic.GetDC())->SetBkMode(TRANSPARANT);
(m_pic.GetDC())->TextOut(0,0,"hello");
hope this should work.
--------------------------------------------
Suggestion to the members:
Please prefix your main thread subject with [SOLVED] if it is solved.
thanks.
chandu.
|
|
|
|
|
Hi,
wen i try to set a viewport in my dialog,
i m recognizing a diff between the coordinates of
device coordinates and logical units..
how can i map them correctly forfurther drawing purposes..
Gita
|
|
|
|
|
wrote: how can i map them correctly forfurther drawing purposes..
That really depends on how you define "correctly".
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
thanks..
but hope thr s a better mapping modes(formulaes) avail'..
Gita
|
|
|
|
|
Gita.Bairavi wrote: wen i try to set a viewport in my dialog,
i m recognizing a diff between the coordinates of
device coordinates and logical units..
When you change the viewport/window settings, that CAUSES a difference between
device and logical units.
If you want them the same don't set the viewport
What are you trying to do?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi,
I'm using the ultimate grid and need to fill it with 8000 rows and about 100 columns. It's rather slow then. Drawing the Grid, Scrollbars of the grid and menubars of the mainframe takes about half a minute.
Did anyone experienced this behaviour and or has an idea or even a solution where to look at the code and where to change the code?
Appreciate any help since I have no clue, Anna
|
|
|
|
|
Please look at this ultimate toolbox support page: Custom Datasources[^]
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
A colleague tried the old version of the MFC Grid. And it is really fast.
He also tested the times with the Ultimate Grid and the pre-population takes less than a second. Minimal usage of memory is also not our goal. The sorting and scrolling within the Grid displayed is also very fast. The problem is only when the grid is redrawn after opening the view, minimizing and maximizing and similar. I don't think I need a custom datasource.
Thanks for your response,
Anna
|
|
|
|
|
Anna Katarina wrote: ...and about 100 columns.
Is this really necessary?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
It' s the worst case. Mostly it will be about 10 to 20 columns with results of calculations. But also people who think they need to view all input data and results i.e. about 100 columns shouldn't wait longer than 3 seconds.
Anyway it takes 10 seconds for only 2 columns. So I don't think the columns are the problems here.
Thanks for your response anyway, Anna
|
|
|
|
|
Anna Katarina wrote: Anyway it takes 10 seconds for only 2 columns. So I don't think the columns are the problems here.
So if there are only two columns involved, the results are rendered in about 10 seconds, but if there are 100 columns involved, the results are rendered closer to 60 seconds. Is that correct?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Ok, the number of columns is a problem as well. But, I can't reduce the number of columns. So, I guess I need to setup a custom datasource.
Thanks again,
Anna
|
|
|
|
|
So why not try to determine if there is a specific column that is causing the delay, or if it is simply the large number of columns?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
That would be an idea when the display of 2 columns and 8000 rows would be sufficiently fast. Additional I have no problems for 30 records and about 200 columns in a different database. That's why I would rather focus on the rows not the cols.
Thanks for your help, Anna
|
|
|
|
|
I never used these grid stuffs, but generally can't you give only the data to the grid which are visible at a certain time. I think from 8000 items some 100 will be visible at a time, if 100 is visible buffer 200 items and give 100 items to controls and when at some threadshold of 50 items update the next 200 items. like that. I don't no whether it is feasible, controls like ListView, TreeView can be made to do this kind of optimisation.
|
|
|
|
|
Anna Katarina wrote: I guess I need to setup a custom datasource.
Did I not tell you that[^]?
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Yeah, you did ...
I'm just struggling how I get the CObList from my doc into the custom data source. There is no "open" functionality necessary. This is already done by the framework (opening of a DBF-File) and I don't want to rewrite most the original doc/view/architecture code. I just wanted to attach the grid to the view to make the view display nicer and easier to read. But the Get/Set cell procedure takes to much time for 8000 rows.
Thanks for all your suggestions so far, Anna
|
|
|
|
|
Use the data source (also known as a virtual mode).
We use the ultimate grid with thousands of rows (20000+) and do not see any performance issues.
|
|
|
|
|
Hello
I have developed an application, which load the Bitmap Image as texture using openGL. My question is, how to zoom a particular point of an image when i click using the mouse left button. Will any body help by providing the suitable source code or Link , so that it help me a lot
I am using VC++ ( MFC's MDI ) and OpenGL .
Regards
Jagannathan
|
|
|
|
|
See if this[^] helps.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|