|
Hi!
I'm trying to accomplish the following:
A main app having a derived CStatic class called CPauseAdm.
A regular MFC DLL having a derived CPauseAdm class called CPauseTestAdm.
I want to make a form of plugin system where the CPauseTestAdm can be used instead of CPauseAdm without being forced to recompile the main app.
So far, I have been able to contruct the CPauseTestAdm class in my main app and call a number of its member functions. But when I try to create the window of CPauseTestAdm the Create function always return 0 and I get just a hwnd=NULL. Could somebody tell me what I'm doing wrong ?
BTW. The CPauseTestAdm object is created by the DLL through a wrapper function. I have tried to create it's window in both the main app and through a wrapper function exported by the DLL but none of these methods worked. Create returns 0 either way...
|
|
|
|
|
You may do this by creating the Generalised class(i mean templates class) in you application so that you can create object of the class whatever you want
just pass the class name into template and use that class..
Hope i understood your question.
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
Huum, I don't understand what you mean by templates class ?
The class I'm deriving from is defined in the main app...
The derived class is successfully created by the DLL so that does not seem to be the problem but when I try to create it's window using Create(...), with parent set to the main apps window, the functions returns 0. Could there be some form of resource problem even though the class derived in the DLL is just a CStatic ?
|
|
|
|
|
Check whether the provided parent of the main apps is correct is valid in the DLL.
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
Yes, the provided parent has correct type (CView) and seems valid.
|
|
|
|
|
How to Create Array of Labels on the Run-Time ?
Best Regards...
|
|
|
|
|
Use new or a vector from the STL.
Now if you want a more precise answer, you have to ask a precise question also. What is a label exactly (it can be a lot of different things). And describe your problem in detial.
Cédric Moonen
Software developer
Charting control
|
|
|
|
|
A label is a static control :
Assuming you mean a static control when you say label.....
CStatic *st=new CStatic();
st->Create("hello",SS_SIMPLE,CRect(0,0,100,100),this,-1);
st->ShowWindow (SW_SHOW);
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
-- modified at 8:01 Friday 16th June, 2006
|
|
|
|
|
Where's the array?
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I want to create Label on run time. (Create dynamically)
And I want this Label must be array like (I use 22 label)
lblArray[0]
lblArray[1]
lblArray[2]
lblArray[3]
lblArray[4]
.....
Thanks..
|
|
|
|
|
This sample create an array of 10 labels:
CArray< CStatic * > mArrayOfLabels;
for( int i = 0; i < 10; ++i)
{
CStatic * label = new CStatic();
label->Create("Label", WS_VISIBLE, CRect(CPoint(0, i * 32), CSize(100, 32)), this, IDC_STATIC);
mArrayOfLabels.Add(label);
}
|
|
|
|
|
Its Not work
I use .NET 2005
Not: .2005 not accept * instead of I use ^
|
|
|
|
|
(The sample was for C++ ordinary MFC projects).
-- modified at 8:40 Friday 16th June, 2006
I think you can post a question in "(Managed) C++/CLI" forum.
|
|
|
|
|
|
this is the code:
#include "stdafx.h"<br />
#include "wininet.h"<br />
<br />
wchar_t *lpszAgent;<br />
wchar_t *server = L"aaaa.t35.com";<br />
wchar_t *username = L"aaaaaaaa.t35.com";<br />
wchar_t *password = L"gaaaaa";<br />
wchar_t upFileName[] = L"test.txt";<br />
wchar_t dir[] = L"test";<br />
HINTERNET hInternet;<br />
HINTERNET ftp;<br />
<br />
void upload(void);<br />
<br />
<br />
<br />
int APIENTRY _tWinMain(HINSTANCE hInstance,<br />
HINSTANCE hPrevInstance,<br />
LPTSTR lpCmdLine,<br />
int nCmdShow)<br />
{<br />
upload();<br />
return 1;<br />
}<br />
<br />
void upload()<br />
{<br />
<br />
<br />
<br />
hInternet = InternetOpen( NULL, 1, NULL , NULL,1);<br />
<br />
ftp = InternetConnect(hInternet, server,21, username, password, 1,1,1);<br />
FtpCreateDirectory( ftp, dir );<br />
FtpSetCurrentDirectory(ftp, dir);<br />
<br />
FtpPutFile( ftp, upFileName,upFileName,2, NULL);<br />
<br />
InternetCloseHandle(ftp);<br />
InternetCloseHandle( hInternet);<br />
<br />
<br />
}
but i get these error no matter i tried in many computer (which installs both Visual studio 98 and Visual studio 2005), i dont' know why? can't any one help me?
Error 7 error LNK2019: unresolved external symbol __imp__InternetCloseHandle@4 referenced in function "void __cdecl upload(void)" (?upload@@YAXXZ) et.obj <br />
<br />
Error 8 error LNK2019: unresolved external symbol __imp__FtpPutFileW@20 referenced in function "void __cdecl upload(void)" (?upload@@YAXXZ) et.obj <br />
<br />
Error 9 error LNK2019: unresolved external symbol __imp__FtpSetCurrentDirectoryW@8 referenced in function "void __cdecl upload(void)" (?upload@@YAXXZ) et.obj <br />
<br />
Error 10 error LNK2019: unresolved external symbol __imp__FtpCreateDirectoryW@8 referenced in function "void __cdecl upload(void)" (?upload@@YAXXZ) et.obj <br />
<br />
Error 11 error LNK2019: unresolved external symbol __imp__InternetConnectW@32 referenced in function "void __cdecl upload(void)" (?upload@@YAXXZ) et.obj <br />
<br />
Error 12 error LNK2019: unresolved external symbol __imp__InternetOpenW@20 referenced in function "void __cdecl upload(void)" (?upload@@YAXXZ) et.obj <br />
<br />
Error 13 fatal error LNK1120: 6 unresolved externals D:\My Documents\Visual Studio 2005\Projects\et\Debug\et.exe 1
-- modified at 7:16 Friday 16th June, 2006
|
|
|
|
|
In the additional lib's have you specified Wininet.lib?
You also need to include the file wininet.h in the file where you are using the API functions.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
You also need to include the file wininet.h in the file where you are using the API functions.
--> does it mean i have to include wininet.h in the "upload" funtion?
|
|
|
|
|
As it seems, that's not the problem.
The errors you get are all link errors, so they originates from not linking wininet.lib
|
|
|
|
|
but i need detail solution? can you or anyone help me ? please!
|
|
|
|
|
If you got VC 6 (as me), do this:
1.
Press AltF7 to get to "Project"->"Settings"
2.
In the left window (top), select "All Configurations"
3.
Click on the "Link" tab
4.
Select "Category" Input
5.
In the edit line under "Object/Library modules", go to the end of the line.
6.
write a space, followed by wininet.lib
7.
Click the "OK" button
Build (or rebuild) the project.
|
|
|
|
|
Have you Selected the proper project. Because after including the files Wininet.h and Wininet.lib the program runs perfectly well.
And if you don't include it It will give the errors as you have described
Cheers
"Peace of mind through Technology"
|
|
|
|
|
stupidmistakez wrote: but i need detail solution? can you or anyone help me ? please!
Just add the following in your Stdafx.h header file
#pragma comment(lib, "wininet");
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
Of course. I'm using it all the time, and still I forgot when I wrote my answer
|
|
|
|
|
kakan wrote: Of course. I'm using it all the time, and still I forgot when I wrote my answer
Remember next time
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
I promise
|
|
|
|