|
it was a question you were supposed to answer in order to help us understand your problem...
BTW, can you post the exact error message returned by the compiler/linker ?
|
|
|
|
|
The way you did for DllObjectDraw . For instance writing an entry in the DLL 's *.def file ot using __declspec keyword. When you create a new DLL project, Visual Studio provides following code (in the DLL header file):
#ifdef YOURDLL_EXPORTS
#define YOURDLL_API __declspec(dllexport)
#else
#define YOURDLL_API __declspec(dllimport)
#endif
and automatically defines the YOURDLL_EXPORTS macro for the DLL project.
When you include such header in your client project, YOURDLL_EXPORTS is not defined and all works smoothly.
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
|
|
|
|
|
Did you link with the lib file ?
|
|
|
|
|
subramanyeswari wrote: I have DllObjectDrawRuntime function defined in wwlib.lib
is this a DLL?
BTW, posting the declaration and definition prototype and the type of project may be helpful.
|
|
|
|
|
I have a lib by bane wwlib.lib. In this lib i have a file dllobjdv.c and have a function like this
VOID
WINAPI
DllObjectDraw( HDC hDC, RECT r, HANDLE hMemInfo );
and i have a header in which i declared like this
VOID FAR PASCAL DllObjectDraw( HDC hDC, RECT r, HANDLE hMemInfo );
and in another lib drawlib.lib i am calling this function like this DllObjectDraw( hDC, r, obj->hMemInfo ); this is perfectly working.
I have another file dllobjvw.c in which i have another function VOID
WINAPI
DllObjectDrawRuntime( HDC hDC, RECT r, HANDLE hMemInfo, LPRECT lpUpdtRect )
and in the header i declared like this
VOID FAR PASCAL DllObjectDrawRuntime( HDC hDC, RECT r,
HANDLE hMemInfo, LPRECT lpUpdtRect);
and i am calling this in one of file of drawlib.lib like this
DllObjectDrawRuntime( hDC, r, obj->hMemInfo,cr );
on selecting go to definition of DllObjectDrawRuntime( hDC, r, obj->hMemInfo,cr ); it is displaying error undefined symbol.
Am i clear
|
|
|
|
|
do you get any linker or compiler error, other than the IDE helper "Goto Definition".
|
|
|
|
|
I am not geting any liner error or compiler error. but on the ide it is displaying symbol not foud. but one serious proble. on debugging it is skipping that function and placing the cursor on the next line
|
|
|
|
|
not sure, may be release build library or build without debug information can skip step in to function.
|
|
|
|
|
how will i be able to transfer data present in a dialog to a listbox in another dialog????
Raja
|
|
|
|
|
If (I assume you want to transfer data between dialogs of the same application) your dialogs are modal then you have to copy first dialog's data to some variable (or array of) and then fill the list box of the second dialog using the copied data.
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
|
|
|
|
|
yes the dialogs are of the same application and i get the error of undeclaredvariable in the second dialog,what should be done???
Raja
|
|
|
|
|
Mohanraj D wrote: what should be done???
Post the code.
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
|
|
|
|
|
str="data";
datatransfer on;
on.DoModal();
and this the listbox in another dialog box
List.AddString(str);
error C2065: 'str' : undeclared identifier
and i have included the header of the firstdlg in seconddlg
Raja
|
|
|
|
|
The scope of str must extend to both the dialogs (i.e. you can make it global or, better you may declare it in the parent window class (and the latter should provide accessor methods to).
Anyway, please have a look at this good (but underrated) toxxct's article [^].
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
|
|
|
|
|
is there anyother methods to do datatransfer,how is a globalvariable declaration done???
Raja
|
|
|
|
|
I strogly suggest you following the toxcct's article approach.
Anyway, using the global variable approach is simple:
(1) declare, in a common included header file, the variable as extern .
(2) define the variable only in one source file.
For instance, in your main header file (let's assume it is YourApp.h )
extern CString g_MyString;
and in the main source file, and only there (let's assume again it is YourApp.cpp )
CString g_MyString;
Now you can use g_MyString in any *.cpp file that includes the main header file (i.e. YourApp.h ).
You may find a working example of global variable in your sources, since Visual Studio generates code for the global variable theApp .
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
|
|
|
|
|
mmm, nice shortcut.
I had it defined in only one cpp as you said, but I was using "extern type var" everywhere I wanted to use it
Thanks for the trick
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
|
|
Another way would be to store your application related information in the registry or in an ini file.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Mohanraj D wrote: error C2065: 'str' : undeclared identifier
The error message tells it all. You have failed to declare str . Should be:
CString str = "data; But that does nothing to solve your original problem. Before calling DoModal() , you need to populate some variable that belongs to your datatransfer class (e.g., array, list, vector). You can either do this by accessing the variable directly, or implement some sort of "setter" method. Then in the OnInitDiaog() method of datatransfer , populate the listbox with the data.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
You can use like this code(If we suppose first dialog is CMain) on the target:
CMain* m_Main=(CMain*)GetParent();
m_main->m_Litsbox
|
|
|
|
|
I wrote a short code to write the status of my program to a file, but when debug in that code, I realize that fwrite function still increase its file pointer but when I read that file by fread function, I can't read that value. This is my code:
// TODO: Add your control notification handler code here
//write config file
FILE *fout = fopen( "config.pcm", "wb" );
if ( fout )
{
//write the time of power function
fwrite( &m_uTime, sizeof( int ), 1, fout );
unsigned long temp;
//write tasks
//number of day task
temp = m_alltasks.size();
fwrite( &temp, sizeof( long ), 1, fout );
for ( int i = 0; i < m_alltasks.size(); i++ )
{
//date
fwrite( &m_alltasks[i].date, sizeof( MYDATE ), 1, fout );
//number of notes in that day
temp = m_alltasks[i].tasks.size();
fwrite( &temp, sizeof( long ), 1, fout );
//notes
for ( int j = 0; j < m_alltasks[i].tasks.size(); j++ )
{
fwrite( &m_alltasks[i].tasks[j], sizeof( TASK ), 1, fout );
}
}
//how many hotkeys have been defined
temp = m_hkArr.size();
fwrite( &temp, sizeof( long ), 1, fout );
//write the list of hotkeys
for ( int i = 0; i < temp; i++ )
fwrite( &m_hkArr[i], sizeof( HOTKEY ), 1, fout );
fclose( fout );
}
else
{
MessageBox( _T( "Can't write config file" ), _T( "Warning" ) );
OnCancel();
}
//unregister hotkeys
for ( int i = 0; i < m_hkArr.size(); i++ )
{
UnregisterHotKey( m_hWnd, m_hkArr[i].id );
GlobalDeleteAtom( m_hkArr[i].id );
}
OnCancel();
They all work except for the code I bolded ( file pointer still increase, but the file is not change )... Help me plz >.<...
|
|
|
|
|
How did you check the file was not actually written?
How did you define m_hkArr ?
How was HOTKEY defined?
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
|
|
|
|
|
I do it on Visual Studio 2005 SP1. I added config.pcm into my solution. After I had run my program, if config.pcm changed the content, then Visual Studio would ask you to update the content of that file. When I debug, I see the file pointer increase, but after I closed fout, VS didn't ask me to update the content -> the content hadn't been modified. m_hkArr is vector <hotkey> m_hkArr. The structure of struct HOTKEY:
struct HOTKEY
{
BOOL isCtrl;
UINT c;
TCHAR szPath[256];
int id; //id of this hot key
};
This struct is self-identified Hotkey . I just check for Ctrl or Alt is press with the key. id is the ID of the hotkey, return value of GlobalAddAtom. The code I have posted just a bit of my code
|
|
|
|
|