|
Member 590310 wrote: i m using exactly the same code as in ur example
I did not provide an example, I pointed you to the MSDN page describing how to achieve what you want to do. Have you coded it exactly as shown? Have you run it through the debugger to ensure your conversion is working correctly?
txtspeak is the realm of 9 year old children, not developers. Christian Graus
|
|
|
|
|
yes i debugged it PTTW->sztext is setting correctly but when i run it garbage is shown in tooltips..my question is that PTTW->sztext is for unicode apps so wat shud be done if app is multibyte.
|
|
|
|
|
Take a look at the page I posted in my previous answer, it shows clearly how to use multi-byte or Unicode for tooltips, and which pointers are used for each type.
txtspeak is the realm of 9 year old children, not developers. Christian Graus
|
|
|
|
|
yes i have read that there is no clue for multibyte it only deals with ANSI or unicode but i need to handle multibyte as my application is multibyte for some reasons.
|
|
|
|
|
ANSI is a subset of multibyte. Windows function calls that end with 'A' handle multibyte as well as ANSI, those that end in 'W' handle wide (Unicode) characters. The sample clearly shows how to code the tooltip methods in order to handle multibyte or Unicode.
txtspeak is the realm of 9 year old children, not developers. Christian Graus
|
|
|
|
|
hi,
how i can set multibyte tooltips to toolbars.any function for multibyte tooltips?
|
|
|
|
|
See the link in my answer to your question above.
txtspeak is the realm of 9 year old children, not developers. Christian Graus
|
|
|
|
|
I wrote something like this :
<br />
MD2Mesh::Frame* md2Frame = (MD2Mesh::Frame*)buffer;<br />
uint8* tmp = buffer + 40;<br />
MD2Mesh::Vertex* vtx = (MD2Mesh::Vertex*)tmp;<br />
md2Frame->vertices = vtx;<br />
The value of "vtx" is changed after the line "mdFrame->vertices = vtx"
U can look at the following debugging table:
vtx | 0x00434140 {v=0x00434140 "ÐBÄ" normIdx=0 } | origin::MD2Mesh::Vertex * |
after line "mdFrame->vertices = vtx" it becomes like this :
vtx | 0x00434140 {v=0x00434140 "@AC" normIdx=0 } | origin::MD2Mesh::Vertex * | md2Frame->vertices | 0x00434140 {v=0x00434140 "@AC" normIdx=0 } | origin::MD2Mesh::Vertex * |
Do u have any ideas ?
|
|
|
|
|
It looks like you've got some cyclic thing going on.
You're setting vtx to something inside md2Frame . But vtx is cast from tmp which is obtained by manipulating buffer . But buffer is cast to md2Frame , in which you are trying to set this value...
I can't say for certain that's the problem, but wouldn't hurt to sort this out properly first.
Almost, but not quite, entirely unlike... me...
|
|
|
|
|
What is type of the buffer? Is it uint8*?
What expected by buffer + 40?
See, buffer + 1 would point to next unint8 position in the buffer. Is that what intended?
|
|
|
|
|
You haven't given us all the types and class/structure definitions involved.
You are also using a mess of casts and potential aliasing issues. You have to know what you are doing and be very careful to get this kind of stuff right.
anbluemoon wrote: MD2Mesh::Frame* md2Frame = (MD2Mesh::Frame*)buffer;
Apparently, buffer is a SomeType_T *buffer set to the address of a block of allocated memory. What is SomeType_T? How big a block of memory? What is a MD2Mesh::Frame? How big is a MD2Mesh::Frame?
Also if MD2Mesh::Frame is not a pod type, you are dead without properly constructing it via its constructor.
anbluemoon wrote: uint8* tmp = buffer + 40;
MD2Mesh::Vertex* vtx = (MD2Mesh::Vertex*)tmp;
Your magic number could be subject to breakage due to changes. Additionally, it hides your intent. Also don't forget about alignment issues and padding that the compiler can insert in structs.
md2Frame now points to the beginning of the buffer.
vtx now points inside the buffer.
anbluemoon wrote: md2Frame->vertices = vtx;
You have now changed part of the contents of the buffer.
vtx has not changed at all. It is however a pointer, and what it points to in the buffer has changed because you wrote code to change it.
Evidently, MD2Mesh::Frame.vertices is 40 * sizeof(SomeType_T) bytes from the beginning of the structure.
Please do not read this signature.
|
|
|
|
|
Here is data structures:
<br />
typedef unsigned char uint8;<br />
<br />
class MD2Mesh<br />
{<br />
struct Vertex<br />
{<br />
uint8 coord[3],<br />
normalIdx;<br />
};<br />
<br />
struct Frame<br />
{<br />
float translation[3],<br />
rotation[3];<br />
char name[16];<br />
Mesh::Vertex* vertices;<br />
};<br />
<br />
};<br />
At first I tried to do something like :
MD2Mesh::Frame* md2Frame = (MD2Mesh::Frame*)buffer
to get the values from the buffer without initializing the pointer and I managed to get the values of translation, rotation and name but the vertices address didn't point to the "buffer + 40(size of translation + rotation + name)" so i just pass the the address of vtx which is buffer + 40
|
|
|
|
|
Again you forgot to mention the type of buffer?
|
|
|
|
|
Hallo,
I upgraded from Visual Studio 2005 to Visual Studio 2008, and converted my Project from from VS2005 to VS2008.
But now I get an Error in the following lines:
LOGFONT lFont;
NONCLIENTMETRICS ncm;
ncm.cbSize = sizeof(NONCLIENTMETRICS);
VERIFY(SystemParametersInfo(SPI_GETNONCLIENTMETRICS,
sizeof(NONCLIENTMETRICS), &ncm, 0));
lFont = ncm.lfMessageFont;
In Windows XP SystemParametersInfo() returns false, and there are the following Values in ncm after executing the SystemParametersInfo() Function:
Screenshot
When I open my Project in Windows 7, it works without problem. In XP I get an access exeption in msvcr90d.dll when I ignore the failed execution of SystemParametersInfo.
Can someone help me?
Thank you!
|
|
|
|
|
I would guess NONCLIENTMETRICS has grown... And VS2008 will default WINVER to a later (higher) value, so the size you have compiled is the "bigger" one.
You pass the size of the structure to SystemParametersInfo - and the later OS can handle the earlier structure. But the earlier OS can't handle the later structure.
Doing a little digging...
http://msdn.microsoft.com/en-us/library/ms724506%28VS.85%29.aspx[^]
typedef struct tagNONCLIENTMETRICS {
UINT cbSize;
int iBorderWidth;
...
LOGFONT lfMessageFont;
#if (WINVER >= 0x0600)
int iPaddedBorderWidth;
#endif
} NONCLIENTMETRICS, *LPNONCLIENTMETRICS;
You can see my theory is probably right.
XP has no idea what to do with the oversized structure you're giving it...
If you want to be compatible with XP, define WINVER to an appropriate value (0x501 I thiiiink) before including the header files.
Good luck,
Iain.
I have now moved to Sweden for love (awwww).
|
|
|
|
|
Thank you, VS2008 sets WINVER to Windows Vista. I now set WINVER in the stdafx.h files of my DLLs to WinXP and now it works.
This is the greatest forum in the world!
|
|
|
|
|
Joschwenk666 wrote: This is the greatest forum in the world!
This is just a tribute!
(you're welcome, glad I helped)
Iain.
I have now moved to Sweden for love (awwww).
|
|
|
|
|
Hi,
I have some code that is as old as the hills and has always worked. It just gets the name of the file to save using the common control Save As dialog:
BOOL GetFileToSave(HWND hwnd, TCHAR *lpstrFileName, DWORD filter)<br />
{<br />
static char szFilter[MAX_PATH_LENGTH], szExtension[12];<br />
BOOL temp;<br />
char *file, *path;<br />
temp = FALSE;<br />
file = malloc(MAX_PATH_LENGTH);<br />
path = malloc(MAX_PATH_LENGTH);<br />
<br />
if (file && path)<br />
{<br />
GetFilter(szFilter, szExtension, filter);<br />
ofn.nFilterIndex = 1;<br />
ofn.lpstrDefExt = szExtension;<br />
ofn.lpstrFilter = szFilter;<br />
<br />
GetPathName(file, path, lpstrFileName);<br />
ofn.hwndOwner = hwnd;<br />
ofn.lpstrFile = file;<br />
ofn.lpstrInitialDir = path;<br />
ofn.Flags = OFN_HIDEREADONLY | OFN_PATHMUSTEXIST | OFN_OVERWRITEPROMPT;<br />
EnableAllWindows(FALSE, 0);<br />
temp = GetSaveFileName(&ofn);<br />
EnableAllWindows(TRUE, 0);<br />
if (temp) strcpy(lpstrFileName, ofn.lpstrFile);<br />
}<br />
if (file) free(file);<br />
if (path) free(path);<br />
<br />
return temp;<br />
}<br />
<br />
I have SOME users on Windows 7 only who find that the Save As dialog can take up to 30 seconds before it allows the OK button to be pressed. In this time it seems to work normally, but it just not respond to OK being pressed.
This code works fine on all our W7 machines, and I suspect some problem with the enumeration of the attached drives. BUT, can anyone see any weakness in the code? As I say, only a few users with W7 report this issue, the vast majority don't get this, but I'm open to any suggestions about improving the code.
- Mark
|
|
|
|
|
Psychopasta wrote: This code works fine on all our W7 machines, and I suspect some problem with the enumeration of the attached drives.
So have you tried attaching those same drives on the machines that work correctly to see if they start misbehaving?
"One man's wage rise is another man's price increase." - Harold Wilson
"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
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Hi David,
Thanks! I am trying to track down any hardware problems like that, but my interest here is in whether anyone can spot something we've missed in the code snippet I posted. It has run just fine for 20 years or so, but you know how it is...sometimes you just 'get away with it' and then something else changes and what used to work just fine stops doing so.
BTW, I should have said originally that the actual API function we use is GetSaveFileName. GetFileToSave is our function to fill the structure ofn which is declared elsewhere as
static OPENFILENAME ofn;
The problem is that GetOpenFileName opens the common control Save As dialog, which -in rare cases- will wait about 30 seconds before responding to the OK button being pressed.
Thanks again,
- Mark
|
|
|
|
|
Hello!
I use CRichEditCtrl ver. 4.1 and try use advanced functions of this control. Unfortunately I have some weird problems. For example when I use numbered paragraphs with letters (PARAFORMAT2.wNumbering = 3 or 4) I get:
a. item 1
b. item 2
...
z. item 26
aa. item 27
ab. item 28
..
yy. item 675
yz. item 676
a'a item 677 - why!? should be "za"!
a'b item 678 ("zb)"
...
a'z item 702 ("zz")
aaa. item 703
.....
When I start list with PARAFORMAT2.wNumberingStart = 677 I got the same error :/
How to fix it? It's MS error? Mayby I must write my own auto-list code
I use TOM interface too but error still happen.
Others inconveniences:
1) TOM uses long type to numering of the list (ITextPara::SetListStart), but RichEdit can use max 65535 items ("crxo" with letters numbering). Sometimes it's too few...
2) ITextDocument::BeginEditCollection/EndEditCollection is not implemented, I can use only Undo(tomSuspend)/Undo(tomResume)
3) I can only use #. #) (#) # for list style numbering
Best regards
W.
|
|
|
|
|
Very simple project (C++ VS 2003) with this error
I use:
PARAFORMAT2 pf;
memset(&pf, 0, sizeof(pf));
pf.cbSize = sizeof(pf);
pf.dwMask = PFM_NUMBERING | PFM_NUMBERINGSTYLE | PFM_NUMBERINGSTART;
pf.wNumbering = 3;
pf.wNumberingStyle = 0x200 | 0x8000;
pf.wNumberingStart = 677;
mvEditor.SetParaFormat(pf);
W.
|
|
|
|
|
I have a project which was started as ANSI, and the project can't be converted to unicode for the foreseeable future. However, I have to display some unicode filenames in a list box by calling the unicode versions of the Win32 functions. But I have a problem.
LPCWSTR strFile = L"Some chinese or arabic unicode text, like that - يتشخيتختصضخيتضختصت.doc";
MessageBoxW(0, strFile, 0, 0);
SendDlgItemMessageW(GetSafeHwnd(), IDC_LISTBOX_FILES, LB_ADDSTRING, 0, (LPARAM) text);
The code above will show the message box with the correct unicode text, but it will display "????????.doc" in the list box. I tried changing the font of the list box but it didn't fix it.
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
What is the text here ?
virtual void BeHappy() = 0;
|
|
|
|
|
Hi friends,
I need immediatly simple treeview in cview full sample code, plz help me.
Thanks and Regards,
D.Manivelan,
|
|
|
|