|
includeh10 wrote: I find 2 group of raw socket functions, one is basic kind, another one starts with WSA.
The WSA functions are the Windows Socket 2 implementation, and just offer some enhanced functionality. They are all described in the MSDN documentation[^]. As far as I am aware the differences in implementation are unlikely to affect the speed.
|
|
|
|
|
Named IP is in english characters, such as "www.hello.abc.efg" - how to convert it to digital IP, such as "196.23.72.90"?
my usage is for raw socket, I did a test, the function inet_addr(...) can change only digital IP address, correct?
|
|
|
|
|
You're going to want to look into DNS lookups, which change human readable URLs, e.g. www.codeproject.com (what you've called a named IP, which isn't strictly correct) in to IP Adresses (what you've called digital IP).
|
|
|
|
|
you are right, named and digital IPs are defined by myself, I don't know how to call them.
|
|
|
|
|
includeh10 wrote: Named IP is in english characters, such as "www.hello.abc.efg" - how to convert it to digital IP, such as "196.23.72.90"?
The former is referred to as the host name while the latter is referred to as as IP dotted address. To get one from the other, you can use gethostbyname() and gethostbyaddr() . Both, however, have been deprecated by getnameinfo() .
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
|
We can use PostMessage() to post integer to HWND if a window handle is valid, but how to post a message to a class object if without HWND?
The story looks like:
MyClass my;
void MyClass::Send()
{
post_message(100);
}
void MyClass::Receive()
{
switch(...)
{
case 100:
....
break;
}
}
how to implement the user function post_message(100)?
|
|
|
|
|
includeh10 wrote: how to implement the user function post_message(100)?
You have to build (or use and existing) communication path between the two objects. Do both objects exist in the same application and thread, or are these disconnected objects?
|
|
|
|
|
They are in same app, sender is in a thread, receiver is in main process - not in thread.
Any more info to implement?
|
|
|
|
|
I am not sure if this is an answer to your question but take a look at PostThreadMessage[^], you do not need to have a window for that, only a message queue in the given thread. You could use that + somekind of mechanism to route the incoming message to the correct instances, like have some identifier or handle in the wParam and the sent integer in the lParam, then on the receiving side you use wParam to identify the instance and call some member function feeding it lParam. Be careful with posting because it might happen that the targeted object gets destroyed before the message arrives and then when you try to call the method of the destroyed instance you get a crash. This of course depends on the implementation. Good luck.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|
|
I agree, this seems the optimum solution.
|
|
|
|
|
|
Kushagra Tiwari wrote: Or you can broadcast the message using flag WM_BROADCAST, if you have made a custom Windows message (eg. WM_SAMPLE_APP (you should have a handler for the same. Also you can internally have the code for things you wanted to do in the handler))rather than posting athread message. Doing this everry active window will recieve this message but since only your application has has handled that message you will be able to get the desired functionality
That doesn't make any sense at all.
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
Will you stop behaving like a child? I don't care about low votes, but not on a programming forum. Because that counts against my contributions here. Your answer was completely senseless, so how about answering only those queries that you have some clue about?
And how about accepting it when someone says you are wrong, instead of acting like a coward and low-voting them? For the record, yes, I just had to mark your answer as "Bad Answer".
You repeat this nonsense and I know where to take it.
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
Hello Sir,
I am sorry for that , but I marked it bad by mistake , and I completely respect you . May be I wasnt able to explain my ans to the fullest . I wanted to mark ur ans as good but by wrong click marked as Bad. Plz Ignore and thre are no hard feelings
Have a very gud day 
|
|
|
|
|
Rajesh R Subramanian wrote:
And how about accepting it when someone says you are wrong, instead of acting like a coward and low-voting them? For the record, yes, I just had to mark your answer as "Bad Answer".
But that was really harsh from your side .. You could have asked first that was it by mistake or I did it intentionally .
Anyways , I think now the misunderstanding will perish .Thanks for guiding me .
Kushagra
|
|
|
|
|
Well, there's no 'harshness' - I just had to express my opinion on your act.
And I'm not sure you had to mark a reply to *you* (which isn't an answer to the OP) as good or bad. Especially, given that there are no "Good Answer" or "Bad Answer" buttons and that you have to specifically click on a number... Now I see it's changed to 5.
However, I'm over it and please don't call me "Sir".
Thank you!
PS: Deleting your message is considered rude on this forum, especially after people have replied to it.
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
Derive that class from CWinThread. This will provide the class with a message pump and message mapping mechanism, and then you could use PostThreadMessage to post a message to it (actually to the thread). Have a message map entry added for all the messages of your interest.
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
Using shared memory might be another way to do what you want to implement.
|
|
|
|
|
hi every body ....
i have some problem in my project...
i.e convertion of word(or)excel to pdf ?
this project is developed in vc++6.0
please help me.......
thanks in advance....
|
|
|
|
|
soo preety wrote: convertion of word(or)excel to pdf ?
You need a PDF library or writer; try Google, there are many options available.
|
|
|
|
|
Is this[^] helpful ?
Regards,
Paresh.
|
|
|
|
|
Hi
I am a newbie in MFC and VC++. I have a tab dialog application with five edit boxes expecting user entry. Everything works fine till the application is in focus. Once the application goes out of focus and comes back the edit boxes refuse to accept the key inputs from the user.
I will explain the procedure in which I found the issue: Application is running and user inputs numbers into the edit box - here it works. User presses Win key + D to show desktop. Application disappears since there is no task bar icon for the application, we need to restore any other window (of any other application) available and minimise it to make my application visible. This is also not desirable but then the edit boxes no longer accept the key inputs. Once i minimise the application to tray and restore, then everything works fine. I need to fix this two issues
I am not sure where to look for a bug in the code. Please help
Sorry for the long problem description.
Thanks in advance
Deepak
PS:
1. I have a pre translate message function to filter out ESC and ENTER key to avoid closing the application by these keys.
2. It has a hidden dialog to avoid showing up in the taskbar area while the application is visible in desktop.
3. It is a tray residing application.
4. All these 3 functionality codes are from CP articles. Is there chance of having an issue in these codes?
|
|
|
|
|
what do you mean about "key press missing"? can not detect chars or keys in WM_CHAR or WM_KEYDOWN? if so, use PreTranslateMessage(), MFC dialog blocks some key events - I don't know why MFC does this.
|
|
|
|
|
includeh10 wrote: what do you mean about "key press missing"?
No characters appearing in the edit field when we type something in the keyboard. My PreTranslateMessage() filters out only the ESCand ENTER characters in my app.
Thank you
Deepak
|
|
|
|