|
Please check whether you have enabled - "Display Unicode strings" option under Tools > Options > Debug tab.
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
All multi-byte functions work on char buffers and not on wchar_t buffers.
«_Superman_»
|
|
|
|
|
Varghese Paul M wrote: But the debugger is not showing the value unless I call CharToOemW. What CharToOem does on that buffer?
I think that the CharToOEM function is converting the string buffer from UTF-8 into the default codepage on your operating system.
Code Page Identifiers[^]
Code Pages[^]
Code page[^]
Best Wishes,
-David Delaune
|
|
|
|
|
Hi, I'm able to set the text and the background color of the text for Status bar, but I'm not able to set the color for the 'seperator' of the status bar.
I have 3 column on the status bar, each of the text and background I'm able to set it but have no luck on the 'seperator'
I've done it by creating a custom status bar inherited from CStatusBar
By drawing it on DrawItem
CODE:
CDC oDC;
CDC* pdc = CDC::FromHandle(pDIS->hDC);
pdc->FillSolidRect(&pDIS->rcItem, RGB(255,255,255));
oDC.Attach(pDIS->hDC);
oDC.SetTextColor(RGB(255,0,0));
oDC.SetBkColor(pDIS->itemData);
pDIS->rcItem.left += 2;
oDC.DrawText(_T("Test"),&pDIS->rcItem,DT_LEFT);
oDC.Detach();
Any ways to do this?
I wanted to change the whole status bar into white color RGB(255,255,255)
Any help would be appreciated.
KH
good
|
|
|
|
|
Is there any ways for me to set the seperator on the status bar become smaller?? by default, the width of it is 0.1cm
Or can I disable/remove the seperator between the item in the status bar ??
good
modified on Tuesday, January 13, 2009 3:03 AM
|
|
|
|
|
Did you try to handle the WM_CTLCOLOR to change the status bar color?
«_Superman_»
|
|
|
|
|
Do i Change the WM_CTLCOLOR on my CCustomStatusBar or on the MainFrm ?
KH
good
|
|
|
|
|
Hi all,
in VC++ by default the charcter set property for project is Use Unicode Character Set.
i want to knoe that which one is more efficient between Use Unicode Character Set and Use Multi-Byte Character Set for SDI type application.
Thanks in advance.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
totally depends upon your requirement,if application need international character support, it need to be unicode aware.You don't have any choice.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
apology for my previous comment, both support International characted. But it totally depend on choice.
MBCS and Unicode[^]
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
UNICODE.
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: UNICODE.
good 5 point for
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Thanks.
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 guess you didn't notice Iain's Post[^]...
Regards,
Sandip.
|
|
|
|
|
You guessed right, I missed it...Ooops, wait a minute, I never miss anything! I'm a god, after all!
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]
|
|
|
|
|
ThatsAlok upport CRY- Child Relief and You
Hi Alok,
So happy to see another CRY Supporter!
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
Unicode would be more efficient because Windows internally uses Unicode.
«_Superman_»
|
|
|
|
|
What I'm using:
VC++ Version 6
MFC AppWizard (.exe)
What I have so far:
When I click a [Shuffle] button, the routine below creates the cards,
shuffles the deck, deals four cards and stores the position in deck
of the last card used .
============================
<pre>
void CAHADlg::OnShuffle()
{
int counter;
int pick;
// Creates Cards
CString card[53];
card[1] = "AS";
card[2] = "2S";
card[3] = "3S";
-----------------------
card[52] = "KH";
// Shuffles Cards
CString deck[53];
for(counter=0;counter<53;counter++)
{
deck[counter]="";
}
for(counter=1;counter<53;counter++)
{
pick=(rand()%52)+1;
while(deck[pick] != "")
{
pick=(rand()%52)+1;
}
deck[pick]=card[counter];
}
// Deals Cards and stores number of cards used
// deck[0] = position in deck of last card used
m_me1=deck[1];
m_dealer1=deck[2];
m_me2=deck[3];
m_dealer2=deck[4];
deck[0]="4";
UpdateData(FALSE);
}
</pre>
============================
What I want to do next:
Click on a [Draw A Card] button and have the routine:
Access the value of deck[0]
Convert the value of deck[0] to an integer and store the integer in variable int n.
Add 1 to n
Access the value of deck[n] and store it in m_me3
Convert the new n value to a string and store it in deck[0]
============================
What I don't know:
Object programming
How to access and change the value of an element of a foreign (same program, different routine) array
Would there me any difference between accessing or changing a foreign int array and accessing or changing a foreign string or char array?
|
|
|
|
|
Please, read the posting guidelines before posting (e.g. use the code tag to format your code properly).
dconnell wrote: How to access and change the value of an element of a foreign (same program, different routine) array
You can't because the array only exists in the scope of the function. Outside the function it doesn't exist.
However, what you could do is declare this array as a class member of the CAHADlg class. This way, it's lifetime is the same as your class, and you can access it from whatever function of the class.
|
|
|
|
|
I wrote some of the programs in Visual Studio and some of them in TASM and NASM. I've encrypted a program I want to hide using an ASM program that does a simple xor on the program. (I did this so no one may know how to write the code I've created, not for malware purposes, but so no one could steal or re-engineer my program.) Now I'm having issues executing the code which is now in memory. Will I need to use a higher level function like those in C++ or MASM to execute the code? I can't figure out how to access it. Many of my methods end in failure to execute. I'm sorry for the vagueness of my questions, but I figure I've been specific enough for help.
|
|
|
|
|
BobMMarley wrote: but I figure I've been specific enough for help.
Not really.
How are you loading the executable into memory? Are you using a PE loader stub which uses an XOR over the code section and then jumps into the original entry point?
Or have you used an XOR on some machine instructions and stored them into a string? If this is the case then the memory will be marked as non-executable and could fail. You can use the VirtualProtectEx Function[^] to modify the memory at that location and give it PAGE_EXECUTE_READWRITE permissions. Alternatively you cound use the VirtualAllocEx Function[^] to allocate some executable memory and copy the bytes into there.
Some documentation:
Data Execution Prevention[^]
DWORD dwLen = sizeof(YourShellCode);
LPVOID lpMemory = VirtualAllocEx(GetCurrentProcess(),0,dwLen,MEM_COMMIT,PAGE_EXECUTE_READWRITE);
CopyMemory(lpMemory,YourShellCode,dwLen);
Best Wishes,
-David Delaune
|
|
|
|
|
Hey Guys,
I have a project I'm using programmed in Visual C++ 6. It's a simulation package that needs to use double precision variables. Because it is a non linear simulation package I need to store a lot of data as Global variables.
My question is how do I speed up access to these variables. Let me illustrate with an example. I came up with my own sqrt function. For my first cut for estimating the mantissa I used a polynomial curve fit and it blew the standard sqrt function away. Unfortunately the accuracy was awful. So I figured I would be clever and I would implement a global lookup table, with regular divisions. I looked at the code and I figured man this is going to be good. Well it was dog slow.
So it dawned on me that using globals while good for code management is not good for speed. I'm just wandering does anyone have any suggestions.
Thanks in advance.
Danny
|
|
|
|
|
Danny Nowlan wrote: Because it is a non linear simulation package I need to store a lot of data as Global variables
I'm not sure that necessarily follows...but anyway.
Danny Nowlan wrote: So I figured I would be clever and I would implement a global lookup table, with regular divisions
Why regular intervals? You want to vary the intervals with the rate of change of the curve, so you're getting a good approximation to the curve with a set of lines.
I've written linear interpolating table lookups for embedded systems - we generally do a binary search over the independent variable to find the points that surround the input, then linearly interpolate between those two. One optimisation that often works is to remember the results of the last lookup (the indices of the two points surrounding the last input) - our systems vary slowly, so the current input often falls in the same range as the last input.
Danny Nowlan wrote: So it dawned on me that using globals while good for code management is not good for speed
Wouldn't have thought the global-ness (or otherwise) of variables would impact the speed of using/writing them. I avoid global variables 'cause they make it too easy to design systems with high coupling between modules - that's bad.
|
|
|
|
|
stdext::hash_map[^]can give you better performance than std::map. std::vector (sorted) also is an option. But map or hash_map will consume more memory than std::vector. If your table is not too big, it's better to implement using global arrays where you can access in constant time ( O(1) ).
Just google, you can see lot of discussion around this topic.
-Sarath.
"Great hopes make everything great possible" - Benjamin Franklin
|
|
|
|
|
Hi,
the problem with global data is every one can access them, which also means the compiler has to allow for data changes all the time, so the data needs to be reloaded into registers/accumulators all the time. One way to improve this is to use local pointers to point into your global arrays. So for each global array you are interested in, create a local (and constant) pointer that points at it, then keep using the local pointers.
I have been designing two floating-point packages in a previous life, and I did study quite a lot of existing ones. I was very much surprised by the amount of code and complexity they were willing to add in order to shave off a few percents of execution time.
So I doubt very much you would come up with something revolutionary, I would rather not trust your initial measurements; blowing away the current implementation by something that has awful accuracy is no good: the standard library has to be accurate up to 1 or 2 of the lowest bits. Of course, if your applications don't need such accuracy, there are certainly faster algorithms to get that.
But don't let me discourage you, when and if you really get good results, I hope we will all hear from you.
|
|
|
|