|
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
|
|
|
|
|
Well, this is different OS. Windows 2000 has features that Win98/95 doesn't have, code changes, etc..
I can't tell you exactly, because have no idea what is the problem in the code.
Philip Patrick
Web-site: www.stpworks.com
"Two beer or not two beer?" Shakesbeer
|
|
|
|
|
I want develop a display driver( maybe a mirror display driver). Ms said in DDK the Mirror Display Driver can get a copy of GDI Oders sent to real display driver. I want get those GDI Oders. Please help me. Tall me howto send those Orders data for my driver to my usermode application.
thanks.
email: Huang_Peng@hotmail.com
|
|
|
|
|
|
Thank you. I read the msdn article, but my driver run in kernelmode! Can not use Win32 API. You known howto use the IPC in kernel mode? Please tell me that howto do in description.
|
|
|
|
|
Hi,
I am a newbie in visual c and my "hello world" program in vc is in 2002 !! I desperately needed some help from big bro in vc regarding memory allocation.
I have created a algorithm using extensive recusive functions. I needed 3 dynamic array inside my functions and so i happily used the "new" operator to help me. ( the array size is ard 100 integers) To my dismay , the array address was allocated so close together that changing some elements in one array will affect my the other array !! I am at a loss of wat to do to avoid this (and in the first place why this happen !!)
Can any kind soul explain to me why such thing happen and what alternative do i have ??
Thank you.
A desperate newbie
|
|
|
|
|
can you show us the memory allocation code you're using?
A man is like a rusty wheel on a rusty cart,
He sings his song as he rattles along and then he falls apart.
-- Richard Thompson
|
|
|
|
|
Hi all,
really thanx a lot for you help !!
my code goes like this:
int *header, *data ;
bool *checkarray;
int *connectcomponent;
width = height = 9;
connectcomponent = new int [width*height/9];
checkarray = new bool [width*height];
data = abc.getBitmapData (); // getBitmapData returns a pointer to a int array which is the same size as checkarray;
I dun see anything wrong but when i run the program... so of the values in data was changed even though i did not issue any command to do so. when I check the address of checkarray and data, i found out that there is only a diff by 0x30 !!
bk
|
|
|
|
|
The allocation of memory side by side, is a natural phenomenon. This is something the compiler and the run time system would handle. I dunno if you can change it. I dont think it is possible .
And how does the allocation of the memory affect your code. IMO you should try and change it in a way that it is not affected by memory allocation structure.
HTH
|
|
|
|
|
It sounds like your using a pointer incorrectly. If you paste some code I'm sure we can pin-point the problem. Otherwise it's to hard to diagnose.
Todd Smith
|
|
|
|
|