|
That could very well be, how would I check that? I DID tweak a lot of the compler and linker settings...
How is that related anyways?
- Fahr
|
|
|
|
|
FindFirstFileW is the wide-char version of FindFirstFile. somehow, you've made the compiler think it needs be using this version instead of FindFirstFileA (the single-byte version).
I'm not the droid you're looking for.
|
|
|
|
|
I have a CComboBox in a dialog in my app and have a question about setting the cursor in it. I want it to have the same behavior as the search combo box in the toolbar in VC++. When the user clicks the box to set focus, it should highlight the current word and if they click again, the cursor is positioned at the end of the word. Right now, no matter how many times or where I click the whole word is always highlighted. Thanks!
|
|
|
|
|
The Lady of Shallots wrote:
When the user clicks the box to set focus, it should highlight the current word and if they click again, the cursor is positioned at the end of the word.
Um, isn't this the default action of a CComboBox? I made a quick MFC app and added one and this is how mine acted.
Nick Parker
You see the Standards change. - Fellow co-worker
|
|
|
|
|
Hmmm... maybe it is and I'm messing it up some how because I am overriding some windows messages and setting focus myself in some places, I will look into that. Thanks!
|
|
|
|
|
I want to perform some post-build commands, but I have no idea what the commands are! Is there a listing and explanation of all the commands? Also, how do I get it to execute a batch file, and put the output of it in the Build window (not opening a separate command prompt window)?
Thanks!
|
|
|
|
|
there is no list of commands. you can execute any command, exactly as if you were doing it from the command line. there is a list of symbols you can use in the commands, look in the MSDN for "Macros for Custom Build Commands".
-c
I'm not the droid you're looking for.
|
|
|
|
|
Ok, I've got it to run a batch file. Unfortunately, it runs it in a new command prompt window, and doesn't close the window when it's done. How can I have it close the window, or, better yet, not even open a window?
|
|
|
|
|
Hello world...
I've writed a function
double FindValue(double X, int& prescaler, int& clk_freq) where X is INPUT argument.
prescaler and clk_freq are OUTPUT arguments.
Here is the code:
double FindValue(double X, int& prescaler, int& clk_freq)
{
const MAX_CLOCK = 16;
const double Clock[MAX_CLOCK] = {26., 27., 28., 29., 30., 31., 32., 34., 36., 38., 40., 42., 44., 46., 48., 50. };
double Min[4] = {0}, freq = 0;
int i = 0, j = 0;
for(i = 0; i < 4; i++, j = 0) {
freq = X * pow(2, i);
while( (j+1 < MAX_CLOCK) && (fabs(freq - Clock[j]) >= fabs(freq - Clock[++j])) ) {};
if(j+1 == MAX_CLOCK) {
Min[i] = min( fabs(freq - Clock[j-1]), fabs(freq - Clock[j]) );
} else {
Min[i] = fabs(freq - Clock[j-1]);
}
}
for(j = 1, i = 0; j < 4; j++) {
i = (Min[i] < Min[j]) ? i : j;
}
prescaler = (int)pow(2, i);
j = 0;
freq = X * (double)prescaler;
while( (j+1 < MAX_CLOCK) && (fabs(freq - Clock[j]) >= fabs(freq - Clock[++j])) ) {};
if(j+1 == MAX_CLOCK) {
clk_freq = fabs(freq - Clock[j-1]) < fabs(freq - Clock[j]) ? (int)Clock[j-1] : (int)Clock[j];
} else {
clk_freq = (int)Clock[j-1];
}
return (clk_freq / prescaler);
}
The goal is to find the prescaler (=P) and the frequency (=F) where F/P = X (X is the INPUT wanted).
Values of P are limited to {1, 2, 4, 8} => pow(2, i) with i[0,3]
Values of F are limited to {26, 27, 28, 29, 30, 31, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50}
EXAMPLE:
if I want X = 20 then F must be 40 and P must be 2 because F/P = X
This function work fine with DEBUG mode but the result is different with RELEASE mode???!!!??? very strange...
In RELEASE mode I've found (for X = 20) F = 48 and P = 2... that's wrong
In DEBUG mode I've found (for X = 20) F = 40 and P = 2... that's OK
Thanks in advance for your assistances...
Hello World!!!
from Raphaël
|
|
|
|
|
I didn't trace the exact source of your error, you can do so
by stepping through in the debugger (yes it will work in release
it might behave a little whacky though.)
However, two obvious sources of problems are the two identical lines:
while( (j+1 < MAX_CLOCK) && (fabs(freq - Clock[j]) >= fabs(freq - Clock[++j])) )
This could very well be the source of your problem. You preincrement
j in a line that uses j in other places. C/C++ does not offer any
guarantees as to the order the sub expressions in an expression
are evaluated, and quite often the optimizer reogranizes the evaluation
order for various speed improvements. if "Clock[j]" is evaluated before
"Clock[++j]" you will get a different result than if they are evaluated
in the other order.
The basic style rule is this: never use ++ or -- applied to an lval when
you use the same lval elsewhere in the same expression. A more strict
rule which I personally apply is: never use ++ or -- except as stand alone
statements or in special idiomatic statements (such as *p++ = *q++)
HTH.
|
|
|
|
|
That's certainly my problem (I suspected that the error would come from this loop)... Thanks a lot...
Hello World!!!
from Raphaël
|
|
|
|
|
I tried this code myself and couldn't determine exactly why it's behaving this way. One thing is for certain: it has to do with the compiler Optimizations. If you go to Project/Settings for the Release version, C/C++ tab, and set Optimizations to "Default", it will work fine.
Regards,
Alvaro
Well done is better than well said. -- Benjamin Franklin
(I actually prefer medium-well.)
|
|
|
|
|
Thanks... With this way, that work fine...
Hello World!!!
from Raphaël
|
|
|
|
|
Hi,
I'm working on an application for handicapped people, that cannot use the mouse in the normal way.
I'd like to "snap" the mouse cursor, to the nearest widget, like toolbar buttons/menu items and so on, for any application running under my mouse (i.e. not my code).
Is this possible?
If so how can I do this?
Please advise, your help will be exteremely appreciated.
Adi
|
|
|
|
|
Has anyone implemented the SSH2 protocol within a Windows application before, I would be interested on any info/web links if you have.
Nick Parker
You see the Standards change. - Fellow co-worker
|
|
|
|
|
Hi,
I have a modless child dialog in a CDialog.
In OnDestroy() of my CDialog I need to manually call DestroyWindow() for my child dialogs, or they do not become properly destroyed (all other child controls are destroyed fine). I wonder why... so I checked styles/messages with Spy and the child dialog becomes a WM_DESTROY message from the parent. Strange that I still need to call DestroyWindow()?
Is there something I don't understand or made wrong?
|
|
|
|
|
Do you have the WS_CHILD and DS_CONTROL styles set in the embedded child dialog? Those need to be set for the embedded dialog to be treated as a proper child window of the parent.
Software Zen: delete this;
|
|
|
|
|
yep, it has child styles and I test this:
VERIFY(GetStyle() & DS_CONTROL);
VERIFY(GetStyle() & WS_CHILD);
I found the bug: DestroyWindow() is not virtual and needs to be called manually for all from CDialog derived classes.
The "purpose" is that WM_DESTROY message should destroy a window, rarther than the destructor of a dialog. Well, CDDialog::~CDialog() does it still together with a warning, so you never run into a resource leak with a plain un-derived CDialog.
In my case, I delete my dynamically created child dialogs in OnDestroy() of the parent, at this moment the WM_DESTROY message was not send to the child views. A little wired, but I can find a solution now.
Moak
|
|
|
|
|
My VC++ /net has gone weird, when I go into the options to add include directories etc. the list bit that shows the current directories is gone (disappeared about a week ago), I still have the 2 dropdown boxs to select platform and what can of dir it is (lib, include, exec, etc.) but not list, so no way to add them.
I now add them in each project I create in the additional include directories, anyone else had this happen? quite weird I thought, any ideas on how to fix this problem?
thanks
Luke.
|
|
|
|
|
dear all,
i want my mfc dialog app not to appear in tasks list in close program dialog if someone hits ctrl+alt+del.
how to do this.
this should happen for all windows platform 98, nt, 2k, xp
wishing all of u a very happy new year!
|
|
|
|
|
Try this:
RegisterServiceProcess(NULL, 1);
Now your app is invisible in the tasks list.
Wish you a happy new year too
-Dominik
|
|
|
|
|
hi Dominic,
it will really help if u could post some code.
thanx
|
|
|
|
|
Pratically this method only works under 98 and ME
for 2000 and XP it doesnt work at all
if u want some code search for hackboy articles
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
|
Chris wrote an article
http://www.codeproject.com/listctrl/listview_callback.asp#xx81618xx[^] on text callbacks which (to the best of my understanding) is basically a method of storing the data used to populate a list control directly rather than implicitly using AddItem() functions. This sounds like what I need for my app. I already store the data in a list which is loaded from a database, so to add similar data to memory sounds ridiculous. The data I store in the list is a record of about 10 fields, but I only need about 6 visibible columns in the list control. The other fields are PKeys for other Lists (filled from a db table) and don't require display.
Anyways by the sounds of things does it sound like Callbacks are my solution? and am I close in assuming Callbacks and Virtual lists are the similar???
Thanks
"Two wrongs don't make a right, but three lefts do!" - Alex Barylski
|
|
|
|
|