|
With AppWizard, you can create two types of DLL projects: MFC and Win32. With MFC, you can create a:
regular DLL with MFC statically linked
regular DLL with shared MFC DLL
MFC extension DLL.
Search MSDN for examples of each.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Yeah, I've done that so far. My question had to do more with issues such as:
- function declaration;
- does MFC act differently when running from a DLL?
- will I have to use CProcessLocal<CMyGlobalData> globalData (i.e.) to handle dynamic data? And if so, how/when should I use it?
I have done a couple of DLLs before, but none had MFC support, so I'm a bit lost out here. I really have no idea how MFC behaves when running from a DLL...
Thanks for your patience though! : )
Dave Nimrod
|
|
|
|
|
dNimrod#X wrote:
function declaration;
Functions are declared the same no matter where they reside. One difference is that exported functions must use __declspec(dllexport) if they are going to be used by other EXEs and DLLs.
dNimrod#X wrote:
does MFC act differently when running from a DLL?
No, but there are precautions that must be taken. For instance, if a function within the DLL will be using a resource that is also contained within the DLL, a call to AFX_MANAGE_STATE() will be required so that the DLL's resource table is looked at rather than the EXE's.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Thanks for the invaluable input!
You have been really helpful.
Dave
|
|
|
|
|
Hi all
I created a windows service that runs fine on windows 2000,xp and 98.
It runs fine on NT but I get a error dialog whenever I try to logoff,restart or shutdown my computer, keeping the service running. This dialog box appears twice, each time I have to press EndTask.
There is no problem if I shutdown my service and then logoff,restart or shutdown my computer.
Any Idea what could be wrong.?
This problem does not arise if I doesnt allow my serice to interact with the desktop. But that is not a solution.
Thanks in advance.
Shiraz
The Best Relligion is Science.
Once you understand it, you will know God.
|
|
|
|
|
Hey, here is my code.
Player::Player( char pName[20] )<br />
{<br />
playerName = pName;<br />
isWon = false;<br />
winsCount = 0;<br />
}
I got the error from this part;
error C2440: '=' : cannot convert from 'char []' to 'char [20]'
There are no conversions to array types, although there are conversions to references or pointers to arrays
playerName is decleared as
char playerName[20] in header file.
Regards,
-
When in doubt, push a pawn!
-
|
|
|
|
|
use strcpy() function to copy array. You can't do it like this.
strcpy(playerName, pName);
It will work
Imagine that you are creating a fabric of human destiny with the object of making men happy in the end, giving them peace and rest at last, but that it was essential and inevitable to torture to death only one tiny creature..and to found that edifice on its unavenged tears, would you consent to be the architect on those conditions? Tell me, and tell me the truth!
-Fyodor Dostoevsky, The Brothers Karamazov
|
|
|
|
|
in this case BugSearcher is right, since arrays have the same size, in general case, you should use
<br />
strncpy(dest,src,number_bytes_to_be_copied);<br />
in order to avoid buffer-overflow
P.S. BugSearcher, I've found a bug in your code
|
|
|
|
|
Thanks both of you.
However, I got warning this time
Warning C4996: 'strcpy' was declared deprecated
c:\Program Files\Microsoft Visual Studio 8\VC\include\string.h(62) : see declaration of 'strcpy'
Isn't there any method that returns nothing? or using in this way is better?
Regards,
-
When in doubt, push a pawn!
-
|
|
|
|
|
HI
i have a problem that i can not cast a Cbitmap to HBITMAP to have a CWND handle. the code below should show my created Bitmap. Please
need a TIP......................!!!!!!!!!!!!
CBitmap pic1;
pic1.CreateBitmap( nWidth, nHeight, nPlanes, nBitCount, lpstr);
pic1.Attach(HBITMAP(pic1));//????????????????????????????????
BITMAP bild_header1;
pic1.GetBitmap(&bild_header1);
CWnd* wp1 = GetDlgItem( IDC_STATIC3);// IDC_STATIC_CAM1
CDC *pDC1 = wp1->GetDC();
CDC imageDC1;
imageDC1.CreateCompatibleDC(pDC1);
imageDC1.SelectObject(&pic1);
pDC1->BitBlt(0,0,bild_header1.bmWidth,bild_header1.bmHeight,&imageDC1,0,0,SRCCOPY);
imageDC1.DeleteDC();
|
|
|
|
|
You don't need to Attach , once bitmap is created. So remove the line, it should work!
ARSALAN MALIK
|
|
|
|
|
Thank you for y answer, have tryed it without attach before but its not running.
Even i need this attach because its necessary to display in the CWND.
So i need some how a HBITMAP and then need to attach it.
Actually the code running well when i am loading bitmap. But not in the way i have done now. I really stuck!"!!!!!!!!!!!
|
|
|
|
|
Hi
have solved the problem
with
CreateDIBitmap
bye
|
|
|
|
|
Hello everybody
I have one question.I want to get some pictures with a webcam. I wrote my Software with Visual C++. It is a Dialog class (MFC). Itried it with capCreateCaptureWindow but it doesn't work.
I hope someone can help me
See you
Michael
|
|
|
|
|
Webcams usually provide some sort of web server, that you can download it from there and then you can display it (as jpeg probably)
But without further info, it's difficult to say how can you do it.
|
|
|
|
|
Hi,
I am new to VC++.
How do I resample(upsample/downsample) any wave file to a predefined value. Basically how do I change the attributes denoted by the WAVEFORMATEX structure, of an already existing file. (for example I have to convert any wav file into 8 khz 16 bit, PCM). The file will be an already existing one and not one to be recorded.
Thanx in advance.
|
|
|
|
|
It's just a matter of math skills. I'm sorry, but I suggest you first read some articles about that.
Don't try it, just do it!
|
|
|
|
|
Hi,
How can I reterive IPv6 address of system. Which API I can use for this.
Thanks for Reply
Regards
Alpha
|
|
|
|
|
Look at getaddrinfo()
in the addrinfo struct there is a sockaddr struct which can have either an ipv4 or ipv6 structure.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain)
|
|
|
|
|
Hi,
This is ok. But i want to know all adapters which are present in the system along with their IPv6 ip addresses.getaddrinfo is socket call. I have tried IP Helper function GetAdaptersAddresses but I don't know it's not returning me IPv6 address. I am getting all details of adapter but not IP address.
Thanks for reply
Regards
Alpha
|
|
|
|
|
hi i want to open an exe as a file in my application. in my dialog box app there is a button when i click on that it will open a exe as a file and search for suppose "t".
how can i open an exe as a file and how to replace a char or string in it.
swarup
|
|
|
|
|
I think you use the GetOpenFileName() to open the exe file
the you need an handle in order to open file using CreateFileA
<br />
HANDLE hFile=CreateFile(filename, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, NULL, NULL);<br />
at this point you should have an handle to your exe file, now we read it into memory using ReadFileA
<br />
DWORD BR=0;
char *tempbuff=(char*)calloc(dFileSize,sizeof(char));<br />
<br />
ReadFile(hFile, tempbuff, dFileSize, &BR, NULL);<br />
<br />
if( BR < dFileSize){<br />
}<br />
now we search the string you're looking for
<br />
char *p=NULL;<br />
p=strstr(tempbuff,"TEXT_TO_BE_SEARCHED");<br />
if( p==NULL)
else you've the first occurrence<br />
for writing you do the same using WriteFile,
bye
Paolo
|
|
|
|
|
After reading the tempbuff. the size of it is showing as 3. i want to read the whole file.
swarup
|
|
|
|
|
Hi,
I have some MFC projects which use the following libs:
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib
Are these libs always necessary for using MFC? How can I know which libs to use and will I get errors compiling/linking when those deleted from the project?
Best regards,
Jens
|
|
|
|
|
They are ignored if not used, if there's a lib missin, you will get an linker error that there's some function missing.
hope that helps
|
|
|
|