|
BoudewijnEctor wrote:
convert hexadecimal numbers to integers
I think you might mean hexadecimal strings to a number.
The C++ library function, strtol() will do the job for you.
Or _tcstol() for the UNICODE compatible function.
long wcstol( const wchar_t *nptr, wchar_t **endptr, int base );
You just need to specify the base, in your case this would be 16.
I Dream of Absolute Zero
|
|
|
|
|
the question is kinda bad!
what do u need the conversion for?
hexadecimal to (int)string or what?
Don't try it, just do it!
|
|
|
|
|
Hi currently i use MSComm32.ocx control i just try to pass data into comm port ,i open port and send data by using
mptr->PutOutput("text"); simple text all fine not any error
arised.But when i try to pass binary data this way
byte bt[] = {1,2,3};
VARIANT vt;
vt.vt = VT_BYREF | VT_UI1;
vt.pbVal = bt;
mptr->PutOutput(vt);
Run time error hr = -2146827908 (Unknown error)!!!
I guess this trouble arised because of i unproperly created vt variable.
And by the way how i can properly create any pointers in variant type??? I think
first step is create array with neccesary values
byte bt[] = {1,2,3};
,second step copy this array to variant union
vt.pbVal = bt;
and third step defint through vt member of VARIANT this type
vt.vt = VT_BYREF | VT_UI1;
Its enought???
How compiler recognized how much ellements on array into passed VARIANT structure???This only pointers and one cant do it i thought???
Sorry for bad Eanglish.
|
|
|
|
|
Guys,
I've created a dockable tool bar. By default on the top of dockable tool-bar, there is a caption bar with close button. I like to remove this caption bar and close button from my tool bar. How can i do so
|
|
|
|
|
Hi
I am tryin to load a TLB file in my project. It is physically present on the disk and is included in INCLUDES and LIBRARY FILES variables of environment. In simple words all is good but compiler is generating following error...
fatal error C1084: Cannot read type library file: 'QTSLimits.tlb': Error loading type library/DLL.
But when I remove that TLB file, error becomes obvious...
fatal error C1083: Cannot open type library file: 'QTSLimits.tlb': No such file or directory
I thought that TLB file is corrupt, but I have compiled it again and againnnn... ANY SOLUTION?
I am tryin to compile VC++5/6 Code on VC .NET
thanks in advance!
mE
---------------------
A gasp of breath,
A sudden death:
The tale begun.
A rustled page
Passes an age:
The tale is done.
|
|
|
|
|
How are you trying to include the type library?
Michael
'War is at best barbarism...Its glory is all moonshine. It is only those who have neither fired a shot nor heard the shrieks and groans of the wounded who cry aloud for blood, more vengeance, more desolation. War is hell.' - General William Sherman, 1879
|
|
|
|
|
have made a .H file...
<br />
#ifndef QIMPQDLTYPES_H<br />
#define QIMPQDLTYPES_H<br />
<br />
#import "QDLTypes.tlb" no_namespace, \ named_guids<br />
#endif // QIMPQDLTYPES_H<br />
and include this .H file in required files... like stdafx.h
help me please... (right now me is practically like this...)
---------------------
A gasp of breath,
A sudden death:
The tale begun.
A rustled page
Passes an age:
The tale is done.
|
|
|
|
|
Can you view the Typelibrary through OleView.exe?
This will help to determine whether the type library is valid.
Michael
'War is at best barbarism...Its glory is all moonshine. It is only those who have neither fired a shot nor heard the shrieks and groans of the wounded who cry aloud for blood, more vengeance, more desolation. War is hell.' - General William Sherman, 1879
|
|
|
|
|
yup.... all info is there :S
please don think I am wasting you time coz me is about to die right now :S
---------------------
A gasp of breath,
A sudden death:
The tale begun.
A rustled page
Passes an age:
The tale is done.
|
|
|
|
|
Dear All,
I am developing an application using MFC VC++ Version 6.0 for Windows 2000.
I have made my application run as a service. The application starts with an icon in the System tray. On double clicking the icon the application starts (ie. dialog boxes are displayed, some background operations are performed, etc..)
The application works very fine when i restrat the system i.e. the system tray icon appears and it performs the apporpriate functions . But when i loggoff the system and then loggin, the tray icon is freezed!!!
The tray icon then doesnot responds to the mouse events (double click , single click or right click)
I know that during loggoff the service keeps on running. And the application is performing its background operations also during loggoff, but the tray icon stops responding.
Do I need to refresh the tray icon ???? Or any alternate solution to above problem
Please comment!
Rohit
|
|
|
|
|
|
|
There can be several problems, but the most likely is that you dont get the notification about the tray creation. Following is from MSDN:
Taskbar Creation Notification
With Internet Explorer 4.0 and later, the Shell notifies applications that the taskbar has been created. When the taskbar is created, it registers a message with the TaskbarCreated string and then broadcasts this message to all top-level windows. When your taskbar application receives this message, it should assume that any taskbar icons it added have been removed and add them again. This feature generally applies only to services that are already running when the Shell begins execution. The following example shows a very simplified method for handling this case.
So you will need to do this and then handle that message
m_nTaskbarCreatedMsg = ::RegisterWindowMessage( "TaskbarCreated" );
And take a look at Chris Maunder excellent class
http://www.codeproject.com/shell/systemtray.asp[^]
Magnus
|
|
|
|
|
I dont think the problem is with getting the notification from tray.
The application works very fine when i restrat the system i.e. the system tray icon appears and it performs the apporpriate functions . But when i loggoff the system and then loggin, the tray icon is freezed!!!
On double clicking the icon the application starts
This means he got the notification atleast once.
Anyway looking at that article can provide him a hint.
"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."
|
|
|
|
|
Dear Jagadessh VN,
When i log off and login the
1) Tray icon appears
2) The background processsing starts
BUT THE SYSTEM TRAY ICON DOESNOT RESPONDS TO MOUSE CLICK EVENTS.
i.e. when i double click or move mouse over the icon, the icon has no response ( i traced my application and it shows no response)
So what may be the problem ??
Thanks .
Rohit
|
|
|
|
|
Hello
I would like to auto run my Floopy Disk which insert in Drive.
How can Trick the win98se/Win2k/winXP?
Please anybody Help me??
I'm Beginner of MFC and Visual C++.
|
|
|
|
|
|
not only beginner to MFC and vc++...
no support for this, because the system does not even know if a floppy is inserted without checking the drive... and this would case the drive to produce the good old "no floppy inserted" sound!
Don't try it, just do it!
|
|
|
|
|
I am trying to use SetWindowPlacement to
display the dailog at the recorded size and position.
The problem is when the dialog appears some part of title
bar( dialog ) missing and whole dialog is not displayed
But if i try to resize the dailog whole dialog appears
Does anyone have solution to this?
Thanks
Shin
|
|
|
|
|
See this article
Start Here[^]
"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."
|
|
|
|
|
Hi
How to convert the Char[1] to UINT?
Thanks
|
|
|
|
|
When you define a variable as char[1] rather than just char:
char CharArray[1];
rather than
char SingleChar;
you have changed a lot!
Even though the array you defined has only 1 element (making it the same as a single char memory usage-wise), it is referenced the same way as if you had defined it as char[1000] - ie as the memory address of its first (zero-eth) element.
Since the value of CharArray is a memory address (in other words CharArray is a pointer), it is not compatible for direct assignment to an UINT.
So, to convert a char[1] to an UINT you need to specify which element of the array you are talking about. In the case of an array of chars with 1 element, the only valid reference is the zeroeth element - CharArray[0].
Whenever you assign a variable that has a data type that is different from the one you are assigning it to, you need to cast it. "Cast" just means that you are basically telling the compiler "Thanks for the warnings, but I know what I'm doing. I know they were defined as different types, but I really want to do this, so butt out!". Casting will only work if the 2 data types are compatible. Since an UINT is large enough to hold the largest possible char and both data types are non-abstract, the types are compatible and your casting will succeed:
<br />
char CharArray[1];
char SingleChar;<br />
UINT x;<br />
<br />
CharArray[0] = 'A'; <br />
SingleChar = 'A'; <br />
<br />
x = (UINT)SingleChar; <br />
<br />
x = (UINT)C[0]; <br />
|
|
|
|
|
Thanks for your reply.
<code>
CString aStr = "中文";//a Chinese CString
char cChinese[3];
cChinese[2] = '\0';
int i = 0;
while (i<aStr.GetLength())
{
if ((byte)aStr[i] >= 0xA1 && (byte)aStr[i] <=0xFE)
{
cChinese[0] = aStr[i];
cChinese[1] = aStr[i+1];
UINT aWord = cChinese // is it possible to assign the arrary to UINT
++i;
}
++i;
}
</code>
|
|
|
|
|
wow9999 wrote:
char cChinese[3];
UINT aWord = cChinese;
Here, you are trying to put the address of your chinese character into the UINT variable.
You could force the compiler to do that, but it probably makes no sense here.
What are you trying to achive here? Assign one chinese letter to the UINT?
Then you need to write something like UINT aWord = cChinese[i];
That means you need to say which letter you want to assign.
Who is 'General Failure'? And why is he reading my harddisk?!?
|
|
|
|
|
wow9999 wrote:
UINT aWord = cChinese // is it possible to assign the arrary to UINT
Yes (at least under VC++ 6.0).
You would need to write it as so:
UINT aWord = (UINT)cChinese;
This is what I said in my previous post. You need to cast it.
But the real question is why? When you assign the value of cChinese to an UINT you are not assigning the value of any char in cChinese - you are only copying the address of the zeroeth element.
If you are trying to look at or manipulate the character codes for the Chinese character set, then you need to assign cChinese[0] to aWord and not cChinese.
|
|
|
|