|
I am writting a Win32-DLL, in resources a define a string-table to store all my messages i will use with AfxMessage().
When I use the DLL in a test application, it uses the string-table of the program not of the DLL-resouces, displaying not desired messages.
What can I do ?
Thanks a lot !
|
|
|
|
|
Call AfxSetResourceHandle() with the handle of your DLL. You can do a LoadLibrary() even if you use the DLL implicitly (imported functions).
int x=1, y=5;
x^=y^=x^=y;
<a href="http://www.codeproject.com/tips/StupidXORTrick.asp" target="_blank">ClickHereForHelp();</a>
|
|
|
|
|
It works !
But now i cannot use the resources of the program.
How can i use several resources definitions together ?
Thanks again !
|
|
|
|
|
|
If using MFC in DLL is an option, you may create 'MFC extension DLL'. Resources in extension DLL and .exe form 'resource chain'. In this case, MFC searches through resources in .exe and all .dlls.
Tomasz Sowinski -- http://www.shooltz.com
Free your mind and your ass will follow.
|
|
|
|
|
Thanks ! I will you MFC extension DLL
I've found also a nice tutorial in
http://www.devx.com/free/mgznarch/vcdj/1997/jan97/evryth1.asp
Best regards )
|
|
|
|
|
I will USE ... I mean, sorry !
|
|
|
|
|
Hello everybody,
In a new application, which a dialog box application i have a message error which appears and which tell me:
" Unhandld exception in Fractal_v1_0.exe(MSVCRTD.DLL):0xC0000005:Access Violation"
(Fractal_v1_0 is the name of my project!)
So, i meet often the problem "Access Violation" caused by mistake in memory allocation for different pointers, but here i don't understand!
so if someone could help me!
thanks in advance for your answers
gerald
|
|
|
|
|
Please, build a debug version and run it under the debugger. Since it faults in the runtime library, it should be obvious why it fails when run in the debugger.
Common reasons for access violations are str...() functions with null pointers or invalid strings (source or target, length wrong), memcpy/memmove with invalid source or target locations. Also overwrites of allocated memory or stack may cause this error.
int x=1, y=5;
x^=y^=x^=y;
<a href="http://www.codeproject.com/tips/StupidXORTrick.asp" target="_blank">ClickHereForHelp();</a>
|
|
|
|
|
Hi I have a problem with return key and dialog based applications. While I run my dialog based application in MSVisual C++, it closes automatically when i press return key (Enter Key). Can somebody help me to get rid of this problem?
Ravi
|
|
|
|
|
|
I've created a simple instant messaging application (Client+server) using TCP protocol.
I want my client to connect to the server via well known proxies also. (e.g SOCKS and HTTP). For this purpose i am in search of any open source code or plugin control that i can easily embed in my client application. If you know any, then please tell me. I would be more glad if the code not uses MFC.
|
|
|
|
|
Hi all, here's my problem.
Im developing an activex control to work as a "proxy" between a server and a pda. The users will go to a webpage and from that webpage, they will be able to update/change the configuration of our app on their pda.
The problem is that sometimes, the files that we need to download are a bit too big to put in the asp generated code so we thought we'd let the activex control do the downloading to pc by itself. This works great with HTTP, using wininet, but fails misserably with HTTPS[1]. Ive checked out msdn and tried the things they say at http://support.microsoft.com/default.aspx?scid=KB;EN-US;Q168151&[^]
Im fairly new to this webstuff thingamajiggs so I thought I'd check to see if anyone has had similar problems with code working with HTTP but not HTTPS.
[1] I get a webpage back saying: "ERROR: The requested URL could not be retrieved"
“Our solar system is Jupiter and a bunch of junk” - Charley Lineweaver 2002
|
|
|
|
|
MSDN[^] contains a nice sample how to download a file as you need it. It works also fine with a https connection.
int x=1, y=5;
x^=y^=x^=y;
<a href="http://www.codeproject.com/tips/StupidXORTrick.asp" target="_blank">ClickHereForHelp();</a>
|
|
|
|
|
Thanks, but I already got that part down. I guess I wasnt clear enough about the problem.
My problem is this:
Everything works dandy with normal http calls.
If its a SSL connection I add INTERNET_DEFAULT_HTTPS_PORT to my InternetConnect call and add the flags INTERNET_FLAG_SECURE|INTERNET_FLAG_IGNORE_CERT_DATE_INVALID|INTERNET_FLAG_IGNORE_CERT_CN_INVALID to my HttpOpenRequest call.
When I run it (using InternetOpen, InternetConnect, HttpOpenRequest, HttpSendRequest, HttpQueryInfo and InternetReadFile) everything returns correct values, but the page/file being sent with https is not the file i requested, but some kind of error page.
<H1>ERROR</H1>
<H2>The requested URL could not be retrieved</H2>
<HR>
<P>
While trying to retrieve the URL:
<A HREF="www.mycurrentclient.com:0">www.mycurrentclient.com:0</A>
<P>
The following error was encountered:
<UL>
<LI>
Invalid URL
</UL>
<P>
Some aspect of the requested URL is incorrect. Possible problems:
<UL>
<LI>Missing or incorrect access protocol (should be `http:
<LI>Missing hostname
<LI>Illegal double-escape in the URL-Path
<LI>Illegal character in hostname; underscores are not allowed
</UL>
<P>Your cache administrator is <A HREF="mailto:root">root</A>.
<br clear="all">
but when calling the exact same URL with a normal HTTP call, I receive the file I was looking for.
So, I guess my question is this: Should I do something other than what MS states in their doc's to be able to do GET's with HTTPS, or could this be a problem with the site im connecting to/the computer im connecting from?
“Our solar system is Jupiter and a bunch of junk” - Charley Lineweaver 2002
|
|
|
|
|
Is the server correctly set up to handle https? Does it have any certificate?
int x=1, y=5;
x^=y^=x^=y;
<a href="http://www.codeproject.com/tips/StupidXORTrick.asp" target="_blank">ClickHereForHelp();</a>
|
|
|
|
|
Yes, it is.
I think I've found my error, but Im trying to re-verify it by having the webguys change something in the asp and I didnt want to post anything until I was sure it was fixed.
The problem was me not using InternetCrackUrl (what a horrible name for a function ), so I sent www.mycurrentcustomer.com/path as server and file.xxx as file in my requests. I changed it to www.mycurrentcustomer.com and path/file.xxx and it worked.
Weird that the old way worked for normal HTPP calls though...
Anyway, thanks for the help!
“Our solar system is Jupiter and a bunch of junk” - Charley Lineweaver 2002
|
|
|
|
|
I have a need to blit a .bmp over a backgound image, but not obscure areas under the foreground image where pixels are deemed to be transparent. I don't want the user to have to supply a mask image. I've read the CP articles on creating masks on the fly, but I just can't seem to wrap my mind around how to blend the two images.
If someone can give me some guidance/pointers, I will be greatly appreciative. To make things even more fun, I'm coding in pure Win 32 - no MFC or ATL!
Thanks in advance.
things could always be worse...
|
|
|
|
|
This is the most known method unless you want to use TransparentBlt function. There is not much to say, other than the bitmap 'hBitmap' must not be already selected in another dc (only one dc can select a bitmap at a time!)
void DrawTransparent(HDC hDC, int x, int y, int nWidth, int nHeight, HBITMAP hBitmap, COLORREF crColour)
{
_ASSERTE(hDC != NULL);
_ASSERTE(hBitmap != NULL);
COLORREF crOldBack = SetBkColor(hDC, RGB(255,255,255));
COLORREF crOldText = SetTextColor(hDC, RGB(0,0,0));
HDC dcImage, dcMask, dcMem;
dcImage = CreateCompatibleDC(hDC);
dcMask = CreateCompatibleDC(hDC);
dcMem = CreateCompatibleDC(hDC);
HBITMAP hOldMemBitmap = (HBITMAP) SelectObject(dcMem, hBitmap);
HBITMAP hBitmapImage = CreateCompatibleBitmap(hDC, nWidth, nHeight);
HBITMAP hOldBitmapImage = (HBITMAP) SelectObject(dcImage, hBitmapImage);
HBITMAP bitmapMask = CreateBitmap(nWidth, nHeight, 1, 1, NULL);
HBITMAP hOldBitmapMask = (HBITMAP) SelectObject(dcMask, bitmapMask);
BitBlt(dcImage, 0, 0, nWidth, nHeight, dcMem, 0, 0, SRCCOPY);
SetBkColor(dcImage, crColour);
BitBlt(dcMask, 0, 0, nWidth, nHeight, dcImage, 0, 0, SRCCOPY);
BitBlt(hDC, x, y, nWidth, nHeight, dcImage, 0, 0, SRCINVERT);
BitBlt(hDC, x, y, nWidth, nHeight, dcMask, 0, 0, SRCAND);
BitBlt(hDC, x, y, nWidth, nHeight, dcImage, 0, 0, SRCINVERT);
SelectObject(dcImage, hOldBitmapImage);
SelectObject(dcMask, hOldBitmapMask);
SelectObject(dcMem, hOldMemBitmap);
DeleteObject(hBitmapImage);
DeleteObject(bitmapMask);
DeleteDC( dcMem );
DeleteDC( dcMask );
DeleteDC( dcImage );
SetBkColor(hDC, crOldBack);
SetTextColor(hDC, crOldText);
}
ÿVOTD: 8 "Love never fails. But where there are prophecies, they will cease;
where there are tongues, they will be stilled; where there is knowledge, it will pass away." - 1 Cor 13:8 (NIV)
|
|
|
|
|
I figured it out. I case anyone else is interested, I did it as follows:
<snip>
// sets up the mask
BitBlt(hdcDst,31,234,43,36,hdcSrc,31,234,SRCCOPY);
clrOldText = SetTextColor(hdcSrc,RGB(255,255,255));
SetBkColor(hdcSrc,RGB(0,0,0));
BitBlt(hdcSrc,31,234,43,36,hdcTmp,31,234,SRCAND);
BitBlt(hDC,31,234,43,36,hdcTmp,31,234,SRCAND);
BitBlt(hDC,31,234,43,36,hdcSrc,31,234,SRCPAINT);
</snip>
If anyone sees any inherent flaws herein, please point them out. My colors looked right and nothing was obscured on the background, so I called it 'fixed'.
things could always be worse...
|
|
|
|
|
I have developed a software using visual C++ 5.0. It works fine in Windows 95 and Windows 98. It does not work when executed under Windows 2000. The error message is as below:
"The instruction at "0x10217a1f" referenced at "0x0043c1a0. The memory could not be "written".
Click on OK to terminate the program
Click on CANCEL to debug the program"
Please help me out from this problem.
G. S. Gupta
|
|
|
|
|
You should debug and see the point in your code where it happens. Noone can tell you anything from info that you've posted
Philip Patrick
Web-site: www.stpworks.com
"Two beer or not two beer?" Shakesbeer
|
|
|
|
|
Thanks for reply.
On debugging, error message comes as "unhandled exception in FIAT.exe: 0xc0000005:Access violation".
Now my point is why this exception does not raised when executing under Windows 95 or Windows 98 OS.
Second problem is I am not able to understand the disassembly code where it goes while debugging.
Thanks and expecting another reply from you.
|
|
|
|
|
Not many people are able to understand the disassembly code But you should go up in stack to find out where it fails in your code, because before it comes to system ddls it passes a code written by you. Also you can check what actions lead to access violation, for example, it happens after displaying CFileDialog... Thus you'll be able to find the code. Also, the program can fail in one thread but when you'll come to debugger you will see another one, so you should check other threads also.
Philip Patrick
Web-site: www.stpworks.com
"Two beer or not two beer?" Shakesbeer
|
|
|
|
|
Thanks For reply sorry for delay from my side.
I shall act according to your reply however could you please answer one thing that why this problem is not happenning in windows 95 or windows98 environment.
G S Gupta
|
|
|
|
|