|
Hi all,
In my application using eVC++ 4.0, I have to draw ellipses with different line styles such as dashed, dotted,
dashed-dotted..
I do it in VC++ 6.0, using Bezier Functions...
But some of the functions are not supported in eVC++ 4.0.
Is there any way to draw these ellipses?
Please help me...
Thanks in Advance,
Arun AC
|
|
|
|
|
As MSDN state,
The SendMessage function sends the specified message to a window or windows. It calls the window procedure for the specified window and does not return until the window procedure has processed the message.
I am facing Problem in this?i just want to transfer data back from the SendMessage,The way The ListView and etc work.
here is my code listing
on_click()<br />
{<br />
char nam1[255];<br />
nam1[0]=NULL;<br />
this->UpdateData(FALSE);<br />
::SendMessage((HWND)this->m_lHandle,WM_USER+90,0,(LPARAM)&nam1);<br />
<br />
MessageBox(nam1);<br />
}
and message Handlling
on_message()<br />
{<br />
char *nam1=(char*)lParam;<br />
<br />
char Text[100];<br />
sprintf(Text,"%u",nam1);<br />
::MessageBox(NULL,Text,"address of Nam1",MB_OK);<br />
strcpy(nam1,"codeproject");<br />
::MessageBox(NULL,Text,"kola",MB_OK);<br />
<br />
}
Both of Code working Fine, but name Variable contain some garbage value insist of codeproject
Any help is greatly apreciated
-----------------------------
"I Think this Will Help"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
You are getting your levels of indirection mixed up.
ThatsAlok wrote:
char nam1[255];
Ok, nam1 is an array of 255 chars, can be accessed as a char*
ThatsAlok wrote:
(LPARAM)&nam1
You are passing the address of nam1, or a char**. You should drop the &.
ThatsAlok wrote:
char *nam1=(char*)lParam;
you are casting a char** to a char*, here is your error
ThatsAlok wrote:
strcpy(nam1,"codeproject");
You end up copying "codeproject" to the address of your string pointer, not the string as you expected.
To see this happen, open up the memory window in VC while you debug your code. watch the memory at mem1 and at the address of mem1.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|
|
Really i am doing very big Pointer Mistake,i am still not able to sort out my problem.
something is missing that i need.
PJ Arends wrote:
ThatsAlok wrote:
char *nam1=(char*)lParam;
you are casting a char** to a char*, here is your error
Here i don't understand what to do??
really i am feeling weak at pointer
-----------------------------
"I Think this Will Help"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
|
i ma goin to lost my Mind if i don't complete this.
the Mentle Wagon is standing outside to send me remand home.if i am not able to transfer the String though send message and get it back.
please please help me . give me right pointer or line,two line of code please
-----------------------------
"I Think this Will Help"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
PJ Arends wrote:
ThatsAlok wrote:
char *nam1=(char*)lParam;
you are casting a char** to a char*, here is your error
actually i am facing problem in this step,i can successfully passing integer value by address but problem is when everi try to change the value of that interger, my MSStudio fails.
ie little code here
sending code
int *ji=new int;<br />
*ji=10;<br />
::SendMessage((HWND)this->m_lHandle,WM_USER+90,0,(LPARAM)*ji);<br />
CString s;<br />
s.Format("%d",*ji);<br />
MessageBox(s);
Receiving Code
int * i=(int*)lParam;<br />
char Text[100];<br />
sprintf(Text,"%d ",*i);<br />
::MessageBox(NULL,Text,Text,MB_OK);<br />
<br />
*i=40;
hope any body understand my problem.
-----------------------------
"I Think this Will Help"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
ThatsAlok wrote:
::SendMessage((HWND)this->m_lHandle,WM_USER+90,0,(LPARAM)*ji);
ThatsAlok wrote:
int * i=(int*)lParam;
You have to fix one of these two lines. In the SendMessage line you are passing 10 (*ji, the value that ji points to) as the lparam. Then in the recieving function you are casting the 10 to an int pointer. So basicly you are telling the program that the integer you want to work with is stored at memory address 10. This most likely gives you an access violation.
In the following code, you will notice that ji is already a pointer (int *ji), so when we send it via SendMessage we do not try to deference it ((LPARAM)*ji) which ends up passing the value 10, nor do we take the address of it ((LPARAM)&ji) which is actually passing a pointer to a pointer to an int (int **).
int *ji = new int;
*ji = 10;
::SendMessage((HWND)this->m_lHandle,WM_USER+90,(LPARAM)ji);
...
int *i = (int *)lParam If you have trouble with pointers read those two excellent articles I pointed you to earlier.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|
|
I found my mistake, Actually I am transferring data between two application as my pointer to memory in not globally accesible it showing garbage value.thanks for helping me, Sir
-----------------------------
"I Think this Will Help"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
hi,
i'm developing a plug in for IE to enable image resize. my problem is, there is no interface for me to receive event notification from the browse regarding the image. Is it any possibility for me to create a custom one, without rebuild the whole browser?
list of event handling interface in DWebBrowserEvent2
http://msdn.microsoft.com/library/default.asp?url=/workshop/browser/webbrowser/reflist_cpp.asp
|
|
|
|
|
Hello !
I have created some classes for Huffman Tree but when I call CreateNode function it appears an error about CharArray string.
What is this error ?
Who can help me about this problem ?
Thank you.
class Node
{
friend class HuffmanTree;
private:
char *CharArray;
unsigned long Frequency;
Node *pLeft;
Node *pRight;
….
}
class HuffmanTree
{
private:
Node *pRoot;
public:
HuffmanTree();
~HuffmanTree();
Node *CreateNode(char *CharArray, unsigned long Frequency);
….
}
Node *HuffmanTree::CreateNode(char *CharArray, unsigned long Frequency)
{
Node *NewNode = new Node(CharArray, Frequency);
NewNode->pLeft = NULL;
NewNode->pRight = NULL;
return NewNode;
}
Node::Node(char *CharArray, unsigned long Frequency)
{
int CharArrayLen = strlen(CharArray)+1;
this->CharArray = NULL;
// delete this->CharArray;
this->CharArray = new char(sizeof(char)*CharArrayLen);
strcpy(this->CharArray,CharArray);
this->Frequency = Frequency;
pLeft = NULL;
pRight = NULL;
}
|
|
|
|
|
Hello,
Your code seems OK except that (IMHO):
- you removed trailling ';' at the end of class declarations
- you do not check for CharArray consistency (e.g. != NULL)
- you should use a more structured syntax (as m_ prefix for data members)
- I would recommand the use of new char[] instead of new char(). It would imply the use of delete [] when destroying the memory block.
You should be more specific about your error. Do you receive an exception ?
|
|
|
|
|
Hello,
Thanks for your response.
I have updated my code and they run well.
I will ask you when i have new errors.
I don't have any exception currently.
Special thanks to you.
Best regards,
Hai
|
|
|
|
|
I wanted to detect if a system (host) has high speed USB ports (ver 2.0). To my surprise CodeProject yielded nothing.
Does anyone has idea where to find that code. Basically user level program that enumerated the hubs, ports and may be attached devices and their information (serial no, manufactuer etc)
paracha3
|
|
|
|
|
Try looking here[^], especially on this page[^].
Software Zen: delete this;
|
|
|
|
|
In the registry under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\DocFolderPaths
lives the paths to all users.
How may I enum them?
How may I find current user?
"Naked we come and bruised we go."
- James Douglas Morrison
Best Wishes,
ez_way
|
|
|
|
|
BaldwinMartin wrote:
How may I enum them?
Use RegEnumKey or RegEnumKeyEx
BaldwinMartin wrote:
How may I find current user?
GetUserNameThe GetUserName function retrieves the user name of the current thread. This is the name of the user currently logged onto the system.
or you can search For a set of Netowrk CLasses at CP to get a class Related to User Enumeration/other user related activities,But that work in window2000 and above.
-----------------------------
"I Think It Will Help"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
Thank you very much for the helpful answer.
Thanks,
Again,
"Naked we come and bruised we go."
- James Douglas Morrison
Best Wishes,
ez_way
|
|
|
|
|
BaldwinMartin wrote:
Thank you very much for the helpful answer.
Thanks,
Again,
Thanks for that WonderFul Thanks
-----------------------------
"I Think this Will Help"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
If you just need the path for the 'My Documents' folder, you can use SHGetFolderPath() [^].
Software Zen: delete this;
|
|
|
|
|
Hi!
Check this link if you want the current user info
http://support.microsoft.com/kb/111544/EN-US/
|
|
|
|
|
Great answer that you! This will help alot.
Thank you,
"Naked we come and bruised we go."
- James Douglas Morrison
Best Wishes,
ez_way
|
|
|
|
|
Great and Thank you, I am trying to get to the GUID folder and it's content. As you know the GUID folders are a little tricky to get access to, so this helps quite abit.
Thanks!
"Naked we come and bruised we go."
- James Douglas Morrison
Best Wishes,
ez_way
|
|
|
|
|
How do you design a skin for your program. What I mean is say there is a light bulb on your desktop but it is actually the program I wrote. Hope someone understands.
Thank You
|
|
|
|
|
Actualy yes! I beleive you want to know more about regions. You can use the to shape windows and buttons, etc... . That is you could use a region to shape a window shaped like a light bulb.
I have not done anything like that for a couple of years, so search for regions at CP. There are quite a few aticles on the subject. I just cann't remember the exact ones you need to read.
Good Luck!
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|