|
I have a word containing umlauts that I need to put on a toolbar button in Word. The project is an ATL/COM addin for MS Word (ANSI build).
The umlauts come out as Cyrillic letters even though our test machine is running a German-localized version of Windows.
This code for example produces correct text in the message box and a Cyrillic letter instead of an umlaut in the Word toolbar:
spButton->PutCaption(L"Öffnen");
::MessageBox(0, "Öffnen", 0, 0);
PutCaption accepts _bstr_t variable as argument, and wants unicode input. And I think that there are two types of umlauts - an ANSI variant which works only if the code page is set to german, and a 16-bit unicode variant, but I'm not sure about that.
And since the cpp file is encoded as ANSI it might be that Word gets an ANSI umlaut when it wants a unicode umlaut.
Is that so or not? And how do I fix the problem in either case?
Thanks.
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
modified on Monday, January 12, 2009 10:08 AM
|
|
|
|
|
I don't know if you're right or not - but it sounds plausible.
What you could do is to put the text in a string table, and use LoadString.
This is good practise anyway - it means you can have different language resources, etc. Hard coded strings in your source is a Bad Idea (tm).
Iain.
Codeproject MVP for C++, I can't believe it's for my lounge posts...
|
|
|
|
|
Hi,
I fixed the problem, and it seems I was right about the Unicode/ANSI umlauts. This code for example didn't produce a MessageBox:
std::wstring unicode = (wchar_t) 0xD6;
unicode += L"ffnen";
if (unicode == L"Öffnen")
::MessageBox(0, 0, 0, 0);
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
Hi @ all,
under XP I have the problem sending UDP Packets over the sendto command.
Sporadically my client didn´t send the packets.
The first time it works fine. I build the packet and then send it with the sendto command. On the second time or more the packet will be created and runs the send command correct. The Remote Port and Address are correct too.
But if I protocol these actions with packetyzer or wireshark the sent packet is not displayed anywhere.
Anyone here who knows what it could be that the packet will not send?
Regards,
Karsten
|
|
|
|
|
Check the return value of sendto API
|
|
|
|
|
the return Value is above Zero and the size of command.
|
|
|
|
|
UDP will drop packets if you send them too fast - here's a Microsoft article that says as much[^].
Fundamentally, UDP makes no delivery guarantees, so if that's important to you, you either want to think about using TCP (that'd be my choice) or implementing some form of handshaking.
I would recommend downloading the IBM TCP/IP Redbook[^] - it's a very useful networking resource.
|
|
|
|
|
But under Vista it works correctly.
And I send SIP Packets above the UDP Socket.
I can´t use TCP because it´s a realtime ip phone I programm.
|
|
|
|
|
CrazyDogg wrote: But under Vista it works correctly.
Which means it's likely a coincidence.
CrazyDogg wrote: I can´t use TCP because it´s a realtime ip phone I programm.
Then it'll be up to you to code the handshaking.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
How to code a handshaking for this?
I have never done this.
|
|
|
|
|
CrazyDogg wrote: How to code a handshaking for this?
However you want to. It's just extra information (usually a CRC) that the send adds to the packet at a specific location (e.g., front, back). The receiver looks at that spot to know if all of the packet has been received. If so, an ACK of some sort is sent back.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
I think it is impossible to made a handshake for this because I just code the client.
The server is an asterisk server and I have no rights to change anything.
|
|
|
|
|
In the book, it says:
the socket passed into ConnectEx needs to be previously bound with a call to bind.
Why does a client socket need binding?
|
|
|
|
|
Ummm - because that's the way the API works?
A socket is a communications endpoint - it needs an address (IP address and port number) before it can be used. For a client, the address is 'localhost' (or 127.0.0.1), whilte the port .
The Microsoft samples I've seen use the connect function rather than ConnectEx . connect doesn't require a bound socket - a bind (I would imagine) to an arbitrary port on localhost occurs within connect . ConnectEx gives a significant amount of flexibility in comparison - and (part of) the price for that would appear to be that you have to do the socket binding yourself.
|
|
|
|
|
Im unable to save a image using CImage. Im able to load and draw it. At a later stage, I need to save it to a different path, so I call Save(). It gives an error '80004005' "Unspecified error".
Please suggest..
TIA
|
|
|
|
|
The debugger is your best friend.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Just now I tried the microsoft's sample. It also gives the same error.. I have nothing to debug. The HRESULT from save is E_FAIL. thats it. the file name is valid. I also tried giving it a simple path name such as "D:\\myImg", but the same error occurs.
TIA
|
|
|
|
|
Does GdiplusStartup succeed?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
|
|
|
|
|
Could please post your code?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
CPallini wrote: Could please post your code?
Hi Pallini.
Yeah but full code ?
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
Nope. Just the relevant one.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I changed my code to use Image class.
I still have the same problem.
I open a image file. then try to save it in png format.
Save fuction returns "Win32Error" status.
GdiplusStartup is successful.
What may be wrong?
|
|
|
|
|
Can you show your code did you attach hbitmap handle to CImage class?
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
Another thing I noted is that if I give only the filename.jpg or png, it saves successfully, but if I give the whole path it fails with Win32Error.
|
|
|
|
|
When you use of filename.jpg it uses of current directory so I think your problem is of path.
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|