|
I presume, you are having problems with multi-threading. 'A thread is supposed to access only those objects which it has created'. If you are trying to copy the new bitmap from the processing thread( not the main thread ) to the Bitmap object created by your main thread, then you have a problem. A workaround would be, to use user-defined windows messages after you are finished with your processing, and thereby notifying your main thread, to copy the newly created bitmap to the original one.
Hope this helps!!!
"A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors."
|
|
|
|
|
I thought of what you mentioned but I found another way to get the program nearly working as I want. I use the PeekMessage-function in the calculation function. This works properly but if you click in the menu, the calculation will stop until you leave it. But I'm statisfied how it works now.
And of course thanks to all who posted suggestions
|
|
|
|
|
Hi all,
i have a DTP control. i want to enter hours, and minutes and not show the seconds at all..... how can i do that?
thanks in advanced
Yaron
|
|
|
|
|
|
Hi,
I have a tree view control in a dialog-based app (non-MFC) and I want to use VK_RETURN and VK_ESCAPE to send the TVM_ENDEDITLABELNOW message to end label editing. This is fairly difficult, because the dialog traps all key messages (I think).
There is an article on MSDN that covers the basics of how to solve this here:
http://support.microsoft.com/default.aspx?scid=kb;en-us;130691
Unfortunately I'm relatively new to coding C++, and I don't know how to go about implementing the advice given in that article.
From the article:
"To work around this problem, subclass the edit control in response to the TVN_BEGINLABELEDIT notification that is sent by the tree view control when the tree view is about to start label editing for an item. To obtain the edit control's window handle, send the tree view control a TVM_GETEDITCONTROL message.
The subclass procedure should handle the WM_GETDLGCODE message by returning DLGC_WANTALLKEYS. This allows the tree view's subclass procedure to handle ESC and ENTER keystrokes."
Could someone explain to me how to subclass the tree view control in this way to get this working, or point me to some examples (non-MFC)?
Many thanks to anyone who can help,
KB
|
|
|
|
|
Take a look at the SetWindowLong function in the Microsoft SDK documentation. This function will allow you to set a new wndproc (GWL_WNDPROC) which is what is meant by subclassing. When you change the wndproc all messages will come to your new wndproc...messages you do not handle should be sent to the original wndproc. You should probably be able to find actual example code by searching msdn as well as information regarding subclassing...there is an article called 'Safe subclassing in Win32' that may get you started
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwui/html/msdn_subclas3.asp
|
|
|
|
|
I want to develop a WLL. For that i need Word Developers Kit. It seems like it no longer available from Microsoft Site/Press... Can any one please help me to get the kit ( The files need to develop a WLL)...
As Word 97 cannot support the COM Add-Ins, i need to develop a WLL. I want my AddIn to work with Word 97 also.
Can u please help me?
Thanx in advance...
Mahesh
|
|
|
|
|
hello
I have writen a winsock client in visual c++,my aim is to connect to a irc channel so i can chat using my own irc client.
before i can join a channel i must register with the irc server,i understand to do this i must first send the following commands (USER & NICK)both theese commands take parameters and i dont know how to write them to the server.my winsock send(); & recv(); functions are working corectly so i must be sending the login data incorrectly.
if any 1 could help me with this subject i would apreciate it.
CString login1;
login1 = "USER chris";
send(Socket,login1,strlen(login1),0);
CString login2;
login2 = "NICK thes3cr3t1";
send(Socket,login2,strlen(login2),0);
here is how im trying to send the login data i have no idia if it is correct i have read the irc rfc and i think im sending the correct data also im unsure of how to seperate the command USER from the Parameter chris.
ahh well thanks
thes3cr3t:(1
|
|
|
|
|
This is how I do it:
CString NickCommand = "NICK " + m_Nick + "\r\n";
CString UserCommand = "USER " + m_Nick + " 0 * :MN\r\n";
Send(NickCommand, NickCommand.GetLength());
Send(UserCommand, UserCommand.GetLength());
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
thank you for your fast response,i have edited your code to suit my app and its definatley getting better,however now i am reciving an error message saying im not giving enough parameters for NICK
CString m_Nick;
CString NickCommand = "NICK " + m_Nick + "\r\n";
CString UserCommand = "USER " + m_Nick + " 0 * :MN\r\n";
send(Socket,NickCommand,strlen(NickCommand),0);
send(Socket,UserCommand,strlen(UserCommand),0);
any further assistance with this would be great thank you!;)
|
|
|
|
|
Where does the error occur? What line? Also make sure m_Nick is not empty, this would make no sense.
modified 12-Sep-18 21:01pm.
|
|
|
|
|
your right thank you very much,just as i got a e-mail notifying me that u left another message in the forum i was editing my last post to inform you that i have sorted the problem.and yes as you said m_Nick was empty,sorry for that little inconvinience my mistake.
you have been a great help!
regards chris
|
|
|
|
|
You're welcome!
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
sorry to be such a nuisance to ya'll,i have spent a good few hours now trying to get this irc server to accept my connection registration attempts however im having no luck,i wonder if any 1 can maybe spot my error.i think the error might lie within the nick command but im unsure.
CString m_User;
CString m_Nick;
CString m_Channel;
CString m_Pass;
m_Pass = "airplane";
m_Nick = "secret";
m_User = "secret na www.baka-baka.com :chris shread";
m_Channel = "#projectx";
CString PassCommand = "PASS " + m_Pass + "\r\n";
CString NickCommand = "NICK " + m_Nick + "\r\n";
CString UserCommand = "USER " + m_User + "\r\n";
CString JoinCommand = "JOIN " + m_Channel + "\r\n";
send(Socket,PassCommand,strlen(PassCommand),0);
send(Socket,NickCommand,strlen(NickCommand),0);
send(Socket,UserCommand,strlen(UserCommand),0);
send(Socket,JoinCommand,strlen(JoinCommand),0);
it all compiles nicely,when the last send(); is executed i am greeted with a error saying i have to register before i can join a channel,so i know thats where the problemb lies
thanx
chris
|
|
|
|
|
Hi
Make sure you use the USER command the same way I did:
CString UserCommand = "USER " + m_Nick + " 0 * :MN\r\n";
And don't forget to react on PING?-requests from the server in order to not time out.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
hmm its no good just dosent seem to want to register i have tried different variations of code and i have also used ur code agsactly as shown,i realy cant understand how the problemb is occuring.
also a quick question,has my code got to wait 4 a NICK or USER verification before it can proceed with the next command,i thought maybe im sending all the info to quickly for the server.
thanks again for your time,and excelent responses.
chris
uk
|
|
|
|
|
I don't know exactly what really causes your problem, sorry
But I have a suggestion for you: When I began (and never finished) building my own IRC client, I first took a look at the built-in client in the filesharing tool "eMule". It is open source. I learned quite a lot from this source about how the IRC protocol actually works
You can download the latest source here:
http://prdownloads.sourceforge.net/emule/eMule0.30a-Sources_complete.zip?download
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
thank you,im sure that will be a great help to me ill d/l the source now and "get stuck in". cheers mate u have been a great help
|
|
|
|
|
No problem! Always happy to help
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Is there any programatic way to get current WAN (global) IP address from the Windows XP machine behind NAT router? If router supports UPnP it may help on this matter, but not sure how to use it. It's easy if other internet server can notify current global IP address to the machine, but it is the last measure and I'd like to prefer independent way, if any.
|
|
|
|
|
I did these 2 programs in turbo c++ and they're supposed to come out like this: Example:
Enter an integer:8
Enter another integer:2
Enter another integer:3
8+2+3=13
So far I got this:
#include "conio.h"
#include "stdio.h"
void main ()
{
int number;
float price;
int number1;
int number2;
int number3;
printf("Enter an integer");
scanf("%d1",& number1);
printf("Enter another integer");
scanf("%d2",& number2);
printf("Enter another integer");
scanf("%d3",& number3);
printf("%d+%d+%d",number1,number2,number3);
getch();
}
and my other one is supposed to come out like this and is similar too:
Example:
Enter a number of eggs:45
45 eggs are 3 dozen eggs with 9 eggs left over.
There is also one other impossible program i'm working on that I seem to have no success on. It reads: run a program that will ask the user for two floating point numbers. The program should display the product(the numbers multiplied together) in the form "The square of __ is __" if the two numbers are the same or "The product of __ and__ is __" if the two numbers are different. I'm been working on them for awhile and have had no success and this is the last place I could turn. Please help me, I will do anything in return. Thanks a lot.
Colin
|
|
|
|
|
colin21 wrote:
printf("%d+%d+%d",number1,number2,number3);
Try:
printf("%d+%d+%d=%d",number1,number2,number3,number1+number2+number3);
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
Didn't I answer this question a few days ago? You may have to change the cin/cout to scanf/printf if you can only use C.
#include <iostream>
using namespace std;
int main()
{
int Eggs;
cout << "Enter a number of eggs: ";
cin >> Eggs;
cout << Eggs << " eggs are " << Eggs / 12 << " dozen eggs with "
<< Eggs % 12 << " eggs left over.\n";
return 1;
}
Here is the other impossible program with the floats:
#include <iostream>
using namespace std;
int main()
{
float Number1, Number2;
cout << "Enter a float number: ";
cin >> Number1;
cout << "Enter another float number: ";
cin >> Number2;
if ( Number1 == Number 2 )
cout << "The square of " << Number1 << " is ";
else
cout << "The product of " << Number1 << " and " << Number2 << " is ";
cout << Number1 * Number2 << endl;
return 1;
}
Good luck!
Douglas A. Wright
dawrigh3@kent.edu
|
|
|
|
|
Hi!
Is there a way to resize Bitmaps and icons, without clipping. For eg., I want to change a 32x32 bitmap into a 13x13 bitmap and want exactly the same picture in both, i.e, I don't want the bitmap to be clipped when it is changed from 32x32 to 13x13. What I want, is the picture to be resized with the resizing of Bitmap.
|
|
|
|
|
Select all, click on one corner and drag it until it is resized to 13x13. Icons must be a stardard size of a factor of 16 BTW.
|
|
|
|