|
When a edit control isn't multi-line or the ES_WANTRETURN style isn't set, then the edit control won't respond with DLGC_WANTALLKEYS to the WS_GETDLGCODE message from the dialog box.
Try overriding WS_GETDLGCODE to add DLGC_WANTALLKEY.
But, I really have to question why you want to change this behaviour. For your own personal application, do what you want. But for an application that is to be distributed or sold, it is a HUGE mistake to change the expected UI just because you don't like it. People will just report this as a bug.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
Hi All,
I'm considering undertaking a little project of my own, and came up with a idea for what I wish to do but currently cannot.
The idea is to simply create a program that gets the video stream from my digital video camera. At the moment I have several programs that can display what is incoming over firewire, including capturing programs and even Explorer in Windows XP.
The problem with all of these is that they are in a pissy little window that cant be made any bigger or maximized.
The program I want to make will simply allow the video stream to be displayed in a resizable window, or maximized to take the full screen. I might add functionality to capture to avi files but first things first that's what I want to acheive. Just a program to watch the video!!!
So if anyone could point me to any information on how to program with the 1394 interface or what I should look at to write this program. I'm pretty new to window programming so this is quite ambitious for me, and so far I have only done a little bit of programming with MFC, but I've got a fair bit of spare time so i'll give anything a go!
Thanks for any advice!
-Mark
|
|
|
|
|
Hello.
I have a doc/view program. The view was derived from CEditView. It however, would not display text when I open a text file with text in it.
For example:
Source file:
---
a
b
c
---
When I open that file up, the program copies the text into a CStringArray object. I can change any line by adding or removing text. However, the program will not display the text in view. The only way to get it to display the text is if I type in the text manually.
The view was derived from CEditView. CEditView allows access to the CEditCtrl. Nonetheless, I cannot find a way to *insert* a CString into the CEditCtrl inside of CEditView. Furthermore, I tried drawing the text, but view still would not display anything.
Is it possible to add text or display text in the CEditView without having to manual type it in? CEditCtrl returns a CEdit reference object. There is a function, GetLine(line, string) to get text from a specific line. However, there are no functions to set the text at a specific line.
Thanks,
Kuphryn
|
|
|
|
|
You need to select a range and then call WM_SETSEL to replace it with a given string.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"I'm somewhat suspicious of STL though. My (test,experimental) program worked first time. Whats that all about??!?!
- Jon Hulatt, 22/3/2002
|
|
|
|
|
I've got a horizontal scrollbar and an edit box that displays the scrollbar's position. I've got it so that the mouse can drag the scrollbar cursor and both arrows on the scrollbar are enabled. Anyways, here are my questions:
1. How do I make it so I can click on a position on the scrollbar and have the cursor go there?
2. Is there anyway to increase the speed of the scrollbar cursor's movement when one of the side arrows is pressed down?
3. Say the scrollbar cursor is on the right side and I drag it all the way to the left quickly. When I let go of my mouse outside the scrollbar region the cursor then returns to the right side instead of staying on the left. How do I fix this?
|
|
|
|
|
ejw wrote:
How do I make it so I can click on a position on the scrollbar and have the cursor go there?
Handle the WM_SCROLL message. The wParam specifies the type of scrolling action. It's SB_PAGELEFT and SB_PAGERIGHT for the kind of operation you described.
ejw wrote:
Is there anyway to increase the speed of the scrollbar cursor's movement when one of the side arrows is pressed down?
AFAIK, you can only do this with spin controls.
ejw wrote:
Say the scrollbar cursor is on the right side and I drag it all the way to the left quickly. When I let go of my mouse outside the scrollbar region the cursor then returns to the right side instead of staying on the left. How do I fix this?
Handle the WM_SCROLL message. The wParam is SB_RIGHT .
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Handle WM_VSCROLL or WM_HSCROLL; depending on the value of wParam, adjust the current position using SetScrollPos(). It's up to you how far each action scrolls.
#1 might be a bit tricky, since clicking anywhere on the scrollbar apart from the arrows and button just triggers SB_PAGELEFT/SB_PAGEDOWN or SB_PAGERIGHT/SB_PAGEUP ; you might be able to calculate the correct position based on the current mouse position though.
Developers that like shiny objects also dig case mods and scratch-and-sniff stickers. Klaus Probst, The Lounge
|
|
|
|
|
Thanks for the help, but I'm still not sure how to handle the second question. I'm not familiar with spin controls.
|
|
|
|
|
I am trying to use hash_map in C++.NET, but it appears that it can only handle numeric value types?! I am needing to use a hash_map of wstrings/wstrings because the conventional map sorts, while a hash_map doesn't sort (what I need). I use the examples that Microsoft provides, but of course they all use integers as the data type. I can compile with integers and other numeric types, but the second I try to use anything else I get an error in <functional>. It says that it can't convert wstring to size_t! This means that hash_map only takes numbers?! Tell me this can't be true. Aren't these templates?
I was so excited when I saw VC7 had <hash_map> and <rope> (VC6 didn't), but now it looks like it doesn't work :'-(
Is there maybe a way to force map to not sort. I don't know of any sorting functors that actually prevent sorting in a map. The STL docs say to use hash_map to prevent sorting, but I guess that's not possible if my compiler doesn't know how to use templates correctly. Any help would be great! Thanx!
Blizzy
|
|
|
|
|
What does your code look like. Please remember to turn off HTLM tags so your < and > appear in your post.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"I'm somewhat suspicious of STL though. My (test,experimental) program worked first time. Whats that all about??!?!
- Jon Hulatt, 22/3/2002
|
|
|
|
|
Thanks for the interest, Christian. Here is the block of code that does work:
hash_map<float,float> intmap;
intmap.insert(pair<float,float>(5,.7) );
and here is what doesn't work:
hash_map<wstring,wstring> intmap;
intmap.insert(pair<wstring,wstring>(L"",L"") );
All I did was change "int" to "wstring" and the values to blank wide strings. The compiler complains about a type cast between wstring and size_t. The compiler points to this block of code in the file xhash as being the problem:
size_t operator()(const _Kty& _Keyval) const
{ // hash _Keyval to size_t value
return ((size_t)_Keyval);
}
Perhaps I am doing something wrong, but I have never had problems with templates before like this. Thanks for your help.
Blizzt
|
|
|
|
|
I suspect you may need to provide the algorithm for getting a key out of a string before you can pass a string in. I'm not sure though, if you're still stuck I'll have a look at home tonight. I've been itching to in any case
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"I'm somewhat suspicious of STL though. My (test,experimental) program worked first time. Whats that all about??!?!
- Jon Hulatt, 22/3/2002
|
|
|
|
|
To use hash_map, you object must be able to provide a hash value. Thus the failure to type cast to an int.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
To use hash_map, you object must be able to provide a hash value.
I'd suspect this is both right and wrong.
Your key must ...
/Mike
|
|
|
|
|
The compiler complains about a type cast between wstring and size_t.
size_t operator()(const _Kty& _Keyval) const
{
return ((size_t)_Keyval);
}
And indeed it seems the compiler should complain here. You must provide a size_t returning conversion function for wstring.
Now I don't know if that size_t is a map::size_t or ::size_t, but perhaps something like the following can help:
size_t operator size_t(const wstring& w)
{
return your_wstring_to_size_t_hash_function(w);
}
/Mike if this works I wrote it, if not I don't know who wrote it
|
|
|
|
|
Mike Nordell wrote:
if this works I wrote it, if not I don't know who wrote it
I'm a big Paul DeLascia fan myself
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"I'm somewhat suspicious of STL though. My (test,experimental) program worked first time. Whats that all about??!?!
- Jon Hulatt, 22/3/2002
|
|
|
|
|
Hi.
Class CProgressCtrl is functionally simple and easy to understand. Nonetheless, I do have one question. How do you calculate the time duration from the start of a job (0% progression) to the completion (100% progression).
For example, let say we have a program that converts all letters in a text file into uppercase.
Original text file:
a
b
c
Output text file:
A
B
C
How do you implement a progression bar such that it displays the completetion animation accurately? I know the example above takes less than a second, but lets just imagine that it takes 10 *or* more.
Thanks,
Kuphryn
|
|
|
|
|
You'd need to get the length of the file and divide it by 100.
It's often difficult to get an exact idea of how long something will take, and often it seems to use more milestones than individual steps. i.e. I can break down my task into 7 sub tasks, I don't know how long most of those will take, so I step the progress counter 7 times instead.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"I'm somewhat suspicious of STL though. My (test,experimental) program worked first time. Whats that all about??!?!
- Jon Hulatt, 22/3/2002
|
|
|
|
|
Thanks.
To my understanding, there no accurate way to handle the process completion percentage. We can approximate. Approximating is good enough for some programs.
Kuphryn
|
|
|
|
|
In one of my apps, I have a repetative task that takes a certain amount of time. I need a progress on the individual task and an overall task. What I do is estimate how long the single task will take and actually measure the time it took. That way I update the estimate for the next run and I get a very accurate estimate of the total time.
As your using an example of a file, in a loop you can get the current file pointer, devide it by the length of the file and * 100 to get a current %age position (this sets the progress control). If you also took the system time at the start of the process, you can work out how long it took to get to the current %age and extrapolate to 100%. You can then subtract the elapsed time to get an estimate of time remaining.
Roger Allen
Sonork 100.10016
yet to be identified being from the planet Paltinmoriumbanfrettybooter
|
|
|
|
|
Nice!
Measuring the time someting takes to complete a cycle can be difficult if the job is fast.
Consider Microsoft's defragmentor. I do not think the programmers use the timer measure. Sometimes the progress bar jumps 20% or more.
Kuphryn
|
|
|
|
|
See this article.
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Hi,
I'm having trouble linking a program. I've installed the latest SDK so I don't think thats the problem. The error I get is
error LNK2001: unresolved external symbol _NetServerEnum@33
I've included lm.h so I don't see what the problem could be.
Thanks for you help
Al
|
|
|
|
|
Are you linking with with netapi32.lib ?
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Hi
I would like to change my freeware-software (MFC) to shareware.
Is there any class/tool I can use to let a customer easy register a trial-version after approx. 15 days? How do I generate keys from an E-mail-address?
Thanks
Ola Carlsson
|
|
|
|