|
hi,
maybe a dumbquestion...
i want to know wenn a key is pressed in my dialog and witch key is pressed. how do i do it?
thanks in advanced...
Willem
[]D [] []D []
|
|
|
|
|
If you go into the Class Wizard under the message maps tab you can select WM_KEYDOWN or WM_KEYUP from the messages section. Once selected add a function to the event and edit the code in the function. The function takes in a parmeter called nChar.
convert nChar to a regualr character by using something like
char myChar;<br />
myChar = char(nChar);
then to find what key was pressed you can do simple comparisons like
if (myChar =='A')<br />
{<br />
}
Michael Shuster
Good Judgement comes from experience; Experience comes from bad judgement.
|
|
|
|
|
tracking WM_KEYDOWN should do it. There's much information about it on MSDN.
|
|
|
|
|
Hi, if tried it and it didn't work, maybe i should add that i want to override the input of inputbox to make my user interfase more keyboard-based.
[]D [] []D []
|
|
|
|
|
Howdy'
I have a UI with a ControlBar ( CSizingControlBar ) that contains a dialog and sub dialogs ( panels ).
The Panels need to be aware when they get the focus.
I tried handling WM_SETFOCUS, WM_ACTIVATE and WM_NCACTIVATE, and I don't receive the messages.
I now handle WM_LBUTTONDOWN to "simulate" the wanted behaviour, but I don't like it, and wandered if I'm missing something ?
Thanks.
Maximilien Lincourt
For success one must aquire one's self
|
|
|
|
|
CString m_test;
sBuffer[2] = "\xE8";
m_test.Format("0x%x", sBuffer[0]);
when i display on the edit box, i get this output
0xffffffe8
it looks like it sign extend the value, any other way to solve it so that i can get 0xe8 instead of 0xffffffe8
regards
afender
|
|
|
|
|
m_test.Format("0x%02x",sBuffer[0]) could work. Haven't used a CString for a while though.
Have a look at boost::format at http://www.boost.org[^] if you like your type safety.
Ryan
They read good books, and quote, but never learn
a language other than the scream of rocket-burn.
Our straighter talk is drowned but ironclad;
elections, money, empire, oil and Dad.
|
|
|
|
|
it still not working, seems like i cant limit the field width
|
|
|
|
|
afender wrote:
sBuffer[2] = "\xE8";
I've had problems like this before, too. It appears that your literal string is actually 4 characters long: slash, x, E, and 8.
Using the format string "0x%02x" will give you a two-character field with an automatic leading zero, if the source value ends up having only one char.
This DOES work, so if your's doesn't, there there is something else wrong.
Dave
"You can say that again." -- Dept. of Redundancy Dept.
|
|
|
|
|
int nVal = 0xffffffe8;<br />
strBuffer.Format("0x%x", nVal & 0xFF);
As far as I am aware fromatting will no truncate the value, it it was:-
BYTE nVal = 0xe8:
It would format as you wanted it.
If I have seen further it is by standing on the shoulders of Giants. - Isaac Newton 1676
|
|
|
|
|
The %x format takes an unsigned int , not a char , so Format() is reading 4 bytes off the stack when you only passed 1 byte of parameters.
Change it to
m_test.Format("0x%x", (unsigned) sBuffer[0]);
And to be extra-spiffy, you can use %#x to automatically add the 0x prefix.
--Mike--
The Internet is a place where absolutely nothing happens.
-- Strong Bad
1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
Hi! I'm a sig virus. Attach me to the end of your sig to help me take over the world!
|
|
|
|
|
hei thks for a ll the helps!
i solve the problem!!
|
|
|
|
|
Hi all-
I'm completely stuck. I am trying to dynamically set buttons on a CToolbar object using SetBitmap() via a memory dc. The code I have is below:
// begin code block
void CBitmap_toolbar2View::OnInitialUpdate()
{
CWindowDC dc(this);
CDC memdc;
memdc.CreateCompatibleDC(&dc);
CBitmap bm;
VERIFY(bm.LoadBitmap(IDR_MAINFRAME));
CBitmap *poldbm = memdc.SelectObject(&bm);
// draw into the dc/bitmap
CBrush brush;
brush.CreateSysColorBrush(COLOR_BTNFACE);
HICON theIcon = (HICON)LoadImage(AfxGetInstanceHandle(),
MAKEINTRESOURCE(IDI_ENTRY), IMAGE_ICON, 0,
0,
LR_DEFAULTCOLOR);
VERIFY(::DrawIconEx(memdc,
0,
0, // dc, x, y
theIcon, // HICON (first small one)
GetSystemMetrics(SM_CXICON), // cx
GetSystemMetrics(SM_CYICON), // cy
0,
brush,
DI_NORMAL)); // frame, brush, flags
DestroyIcon(theIcon);
theIcon = (HICON)LoadImage(AfxGetInstanceHandle(),
MAKEINTRESOURCE(IDI_ORDER),
IMAGE_ICON,
0,
0,
LR_DEFAULTCOLOR);
VERIFY(::DrawIconEx(memdc,
32,
0, // dc, x, y
theIcon, // HICON (first small one)
GetSystemMetrics(SM_CXICON), // cx
GetSystemMetrics(SM_CYICON), // cy
0,
brush,
DI_NORMAL)); // frame, brush, flags
memdc.SelectObject(poldbm);
((CMainFrame*)GetParentFrame())->m_wndToolBar.SetBitmap((HBITMAP)bm.Detach());
((CMainFrame*)GetParentFrame())->m_wndToolBar.Invalidate(TRUE);
((CMainFrame*)GetParentFrame())->m_wndToolBar.SetButtons(NULL,2);
}
//// end of code block
I made the toolbar in the frame public just to make it easier to play with.
So I have two icons that I want to set on the toolbar. The two calls to DrawIconEx() sets the first icon at 0,0 and the second one at 32,0 but what I see is the first icon twice. I have zero clue as to why I should see the first icon twice, especially when I call DestroyIcon() between DrawIconEx() and LoadImage() for the second icon.
Any help would be appreciated, this is something of a showstopper and I have no way of getting around it right now.
Ron
|
|
|
|
|
Why don't you use a regular toolbar bitmap strip?
Steve S
[This signature space available for rent]
|
|
|
|
|
The problem is that the toolbar is variable....the buttons that would appear in the toolbar, as well as their order, are variable. In addition, I already have several dozen ico files which would all have to be mushed together into one big bitmap.
|
|
|
|
|
Hello,
I would like to sort a vector(vlines), this is a vector with struct's(line).
I want to sort the vector on name and on length.
struct line{<br />
CString name;<br />
double length;<br />
};<br />
<br />
vector<line> vlines;
I know there is a function sort and that it uses a predikaat function.
<br />
std::sort(vlines.begin(), vlines.end(), length<line>());<br />
std::sort(vlines.begin(), vlines.end(), name<line>());<br />
But how can i code the predikaat function's? or template's??
I hope someone can help me?
Thanks
|
|
|
|
|
Those predicates are anything (functions, objects) that can be called with the same syntax as a function. So, even a function can do; for instance:
inline bool compare_line_by_length(const line&x,const line& y)
{
return x.name<y.name;
} can be fed to std::sort like this:
std::sort(vlines.begin(), vlines.end(), compare_line_by_length);
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hi,
How can I remove OK and Cancel buttons from my PropertySheet to add only Close button???can u plz respond immediately??
thanks in advance
ThomasKennedyBose
|
|
|
|
|
|
Hi.....Its Great.....thanks a lot...thanks for your immediate response
ThomasKennedyBose
|
|
|
|
|
could anyone give me help on sending data to a fly pen plotter, how to use hpgl for the same ..any help article link would also do..
|
|
|
|
|
Most of the plotters I have ever worked with took a serial character stream of commands, in whatever goofy syntax was unique to each one. The trick was always to get the command strings formatted properly before sending them to the plotter.
That was many years ago, so the memory is a little fuzzy. Didn't a Google search help any?
Dave
"You can say that again." -- Dept. of Redundancy Dept.
|
|
|
|
|
Hi,
I wanna get the number of records of a table from an Access database by CDatabase & CRecordset classes.
What is the appropriate function?
Thank you in advance.
|
|
|
|
|
A typical SQL query to do this is
<br />
SELECT COUNT(*) AS Total FROM Table WHERE condition<br />
You access the return value as you would a value from a conventional query
Roger Allen
Sonork 100.10016
Were you different as a kid? Did you ever say "Ooohhh, shiny red" even once? - Paul Watson 11-February-2003
|
|
|
|
|
Hi!
I'm looking for a source documentation tool that uses a Doxygen like documenting syntax (/** or /// or /!* etc) but produces XML-files that are compatible to the default C#-xml-documentation. I'd like to use the output in NDoc to create the final chm-files. Does anybody know about such a tool?
- Andre
|
|
|
|