|
G'day. I have some articles on GDI+ on this site, which show how it is done. Or you can use CXImage or another third party library ( CXImage is also on this site ).
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
Hi Satya,
If you are using VC7 you can use CImage classes for converting images or like as Christian said, you can try any of the code here.
<edit>
you can also try IPicture interfaces if you are ok with COM
</edit>
Cheers
Kannan
|
|
|
|
|
|
I have a PC with allo the dev tools from microsoft.
I wrote some changes to the software(in VC++ ,MFC) that my company has and didn't have any problems on my PC(with WINNT) but when other users in the company tryed using the software on winnt they got Dr Watson.
I tryed the tool DRWTSN32 and got the following info in the log file(from which i understand the fault is in a function called Ordinal6442 that i couldn't find):
"
function: Ordinal6442
5f45c207 8d45d4 lea eax,[ebp-0x2c] ss:0102d7c2=????????
5f45c20a c745d428000000 mov dword ptr [ebp-0x2c],0x28 ss:0102d7c2=????????
5f45c211 50 push eax
5f45c212 6a00 push 0x0
5f45c214 6805040000 push 0x405
5f45c219 895dd8 mov [ebp-0x28],ebx ss:0102d7c2=????????
5f45c21c ff7720 push dword ptr [edi+0x20] ds:00efea06=????????
5f45c21f ff154cb5495f ds:5f49b54c=77e72566
call dword ptr [Ordinal636+0x11a1 (5f49b54c)]
5f45c225 e9c58bfaff jmp Ordinal4809+0x50 (5f404def)
5f45c22a ff6060 jmp dword ptr [eax+0x60] ds:00efea06=????????
FAULT ->5f45c22d 8b01 mov eax,[ecx] ds:6f6d532c=????????
5f45c22f ff5058 call dword ptr [eax+0x58] ds:00efea06=????????
5f45c232 e9f599faff jmp Ordinal2446+0x36 (5f405c2c)
5f45c237 8bce mov ecx,esi
5f45c239 e8198bfaff call Ordinal2463 (5f404d57)
5f45c23e e9f399faff jmp Ordinal2446+0x40 (5f405c36)
5f45c243 8b06 mov eax,[esi] ds:0012fccc=5f4a6d68
5f45c245 ff9088000000 call dword ptr [eax+0x88] ds:00000088=????????
5f45c24b 8b00 mov eax,[eax] ds:00000000=????????
5f45c24d 85c0 test eax,eax
5f45c24f 0f858a5efaff jne Ordinal2385+0x11 (5f4020df)
5f45c255 ff7510 push dword ptr [ebp+0x10] ss:0102d7c2=????????
*----> Stack Back Trace <----*
FramePtr ReturnAd Param#1 Param#2 Param#3 Param#4 Function Name
0012edbc 0042061b 0057ad40 0057ad40 ffffffff 6f000000 !Ordinal6442
0012ff00 5f40b4f3 01bbe198 0013399e 00000000 004eefcd !<nosymbols>
0012ffc0 77f1b9ea 01bbe198 77c440e0 7ffdf000 c0000005 !Ordinal1576
0012fff0 00000000 0046de06 00000000 000000b0 00000100 kernel32!GetProcessPriorityBoost
00000000 00000000 00000000 00000000 00000000 00000000 !<nosymbols>
"
Please tell me how can i find the function that caused the exeption?
Thanks.
avivhal
|
|
|
|
|
Hello !
So, his follows a question I asked yesterday : I need to run a prg which the first it is run time will open excel, and the next times it is called it will bring the excel window on the top and give it the focus.
The first part is ok. The second part does not work. Here is my code :
HWND hWnd;
hWnd = ::FindWindow("XLMain",
NULL
);
if (hWnd!=NULL)
{
::BringWindowToTop(hWnd);
::ShowWindow(hWnd,SW_SHOW);
}
else ...
I've actually tested BringWindowToTop,ShowWindow,SetWindowPos,SetWindowPlacement,MoveWindow but none of these functions are working ... so pls help me before i get with it.
Thanks
~RaGE();
|
|
|
|
|
|
Shog9 wrote:
There's a section on grabbing focus in it
Brilliant, it works !!! Shog, I love you (BTW, Big thanks to Nish also )
~RaGE();
|
|
|
|
|
SetWindowPos has always worked for me, if it does not work I can only assume some code in the other window is bringing it down again.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
That's what I thought until today. Well, I'll keep a link on Nish's article, it might be useful ...
~RaGE();
|
|
|
|
|
Hello.
I'm writing an ActiveX control which was created by MFC ActiveX ControlWizard. I run the ActiveX control in Internet Explorer. I'm trying to obtain a pointer to the container to be able to change the html-page from the ActiveX control.
In the control class which is derived from COleControl I have to following code:
LPOLECLIENTSITE lpSite = GetClientSite();<br />
LPOLECONTAINER lpContainer; <br />
if(lpSite == NULL) AfxMessageBox("Click OK to crash..."); <br />
lpSite->GetContainer(&lpContainer);
The problem is that GetClientSite() returns NULL so the application crashes.
Any help is greatly appriciated. Thanks in advance.
/Charlie.
|
|
|
|
|
Hi,
I've got a code which is adding 2 non-printable characters at the end of the string, which is causing a lot of problem.
Can anyone help me in removing these 2 "funny" characters.
Here is the code
[CODE]
========================================
#include <winsock.h>
#include <windows.h>
#include <iostream.h>
#include <string>
#include <conio.h>
using std::string;
const char *yy;
int u,i;
string final = "<req><loginid>8888<reqtype>08<broadcast><messagetype>M<no>5359846<message>\n";
void main()
{
final.append("<date>02/10/2002 14:30:10\n");
yy=final.c_str();
u=strlen(yy);
for(i=0;i<=u;i++)
{
printf("%c %d\n",yy[i],yy[i]);
}
}
===========================================
[CODE]
Kindly help!!
Many Thanks,
John
|
|
|
|
|
Hello,
simply replace
for(i=0;i<=u;i++)
by
for(i=0;i<u;i++)
So, remove the =.
Then the 2 "funny" characters should not occur.
-Dominik
|
|
|
|
|
Hi Domnik,
I did that and its not removed the second character.
What comes towards the end is 10 and 0.
When I do a for(i=0;i
|
|
|
|
|
You mean the number representation of the linefeed-character?
Well, you could count two less than the string-length (CR/LF), or you could introduce a filtering line, that does skip any LF characters. That way you would even skip internal CR/LF sequences.
"My opinions may have changed, but not the fact that I am right."
Found in the sig of Herbert Kaminski
|
|
|
|
|
By the way: C++ like would be doing that with iterators. Its just as easy and less error prone. (see your index error dominic has shown)
"My opinions may have changed, but not the fact that I am right."
Found in the sig of Herbert Kaminski
|
|
|
|
|
As jh pointed out, you have to change the u to
u=strlen(yy) - 2; when using CR/LF (\r\n)
and u=strlen(yy) - 1; when using LF only (only \n).
|
|
|
|
|
Hi Dominik and Jh,
Yes, your suggestions worked out.
Apparently the problem still persists and I've got no clue why its happening..
What I am doing is just sending in some data to another server using a sendto(). The server program is written in Java.
But when I send it, the server gets it with some non-printing character (ASCII '0') in the begining and it's causing a problem.
Any suggestions, what could be going wrong?
Here's the sendto() code
[CODE]
========================================
e = sendto(sd,final.c_str(),final.length(),0,(struct sockaddr *)&saServer,sizeof(saServer));
========================================
[CODE]
Many Thanks,
John
|
|
|
|
|
Hi Dominik and Jh,
Just out of curiosity, can we do something like concatenating 2 strings? Something like this in sendto()?
========================
e = sendto(sd,"string1"+"string2",lenght(),0,(struct sockaddr *)&saServer,sizeof(saServer));
========================
Many Thanks,
John
|
|
|
|
|
Hi!
I've two identical machines (NT4.0, same IE, SP6a). I got a program that works in one machine, but the other one gives a messagebox "Microsoft Visual C++ Runtime Library", "Runtime Error!", the name of the program crashing and "abnormal program termination.
The machines are supposed to be totally identical basic installation (except the other one has more programs installed on it).
What files should I check to have the same versions?? What is causing that? Comctl32 is the same, so is MSVCRT.DLL.
|
|
|
|
|
This can be a very tricky problem. Look with the dependency Walker which dlls you are using and compare the versions.
IMHO it looks like a initialization error. A value out of the registry is missing or a file can´t be opened because the path doesn´t exist.
I would start a debug build on the crashing machine.
Try this @ home. (B&B)
|
|
|
|
|
at run time i want to known a fuction's caller ,how can?
for example:
void a(int i)
{
CString szCaller = GetTheCaller();
MessageBox(szCaller);
}
void b(int j)
{
a(j);
}
I'd like to get a message :"void b(int j)"
How to implement method "GetTheCaller()"
Scratch
|
|
|
|
|
How 'bout just passing the caller as a string argument?
Getting the calling function's name as a string is way beyond my knowledge
|
|
|
|
|
It's a good idea,but didn't fit my application.
Scratch
|
|
|
|
|
You want a stack trace, huh?
I did it once and regreted it. It was a great bunch of work.
Some starting points:
1. Look at the StackWalk Win32 API function. Walk the stack until you find the calling function.
2. Once with the address of the calling function, you'll need the SymFromAddr Win32 API function.
3. You'll need to ship the PDB file together with your application, because the Symbol functions will need this file.
If you only need this info for debugging purposes, you could try looking, IIRC, the address (&i)[1] (the address of the first parameter + 4 bytes. In your case, the parameter is an int), which will give you the return address on the stack. This is a hack and can fail for a hundred reasons, including the automatic inline made by the optimizer. The right way of doing it is the StackWalk way.
I see dumb people
|
|
|
|
|
How about creating a global array of some appropriate size, adding a call in every function in your code to add its own name to the array, and then at any point, just get the last so-many elements to know where you came from?
It's not really a call "stack" as much as a call "trace." The caller of any function would be the last element in the array.
The function to add to the array would have to do all the proper subscript incrementing and roll-around, making it a circular list of the last some-number of functions called.
This may not be appropriate, because you do have to add something to every function.
Dave
"You can say that again." -- Dept. of Redundancy Dept.
|
|
|
|