|
I am wondering how I could read in a file without neccessarily storing it, in order to just find the length of the file so that I can create an array the specific length of the file. Thanks
|
|
|
|
|
What do you mean without storing it?
1. There is a structure stat and a function _stat (header types.h, refer MSDN)
2. You can use the FindFirstFile function to get the file info structure which contains the file attributes (MSDN again)
These two ways get you the file size without having to open in explicitly.
Hope this helps
"It was when I found out I could make mistakes that I knew I was on to something."
-Ornette Coleman
"Philosophy is a study that lets us be unhappy more intelligently."
-Anon.
|
|
|
|
|
|
In my vc++ codes, I must use the filter of the Object recordset to filter some records, I get the query term from a EditBox, but when the term include the character "%", the filter seems to meet some problem in deal with the "%",
What should I do, some body tell me how please.
What's more, when the operater is ">" or ">=", the filter meet the same error.
Could some one tell me why ?
Thanks advance.
|
|
|
|
|
Most databases require special characters to be escaped if they are part of sql. For some databases you can choose you escape sequence others have predefined '\'....
Characters '[,=+-&%#!@">
|
|
|
|
|
I am trying to figure out a way to create a simple toolbar for IE, or MOZILLA or both..
All I am looking for is to hyperlink to 2 different websites. I am trying to get 2 Main headings for each site, and a drop down list under each for different pages on that site, can anyone help, I am a 26 y/o NEWBEE to programming.
I am hoping to get it too look like this:
Main Topics as if this was the toolbar and drop down menus
CSRA Light Flyers Trenton Flyers
Home Home
Pictures News
News Pictures
Thanks!!
Eric Marenyi
|
|
|
|
|
I do not completely understand what you wanna achive.
You can surely extend Internet Explorer but only with the following things:
1.New Toolbar buttons (but no dropdown possible)
2.New Menu items (very restricted, only under Tools, and Help)
3.Hor or vertical Explorer bars (they look like the treeview in Window Explorer on the left but anything not only trees can be implemented on them)
If you click on the "History" or "Favorites" buttons such Explorer bars are shown.
That's it, no other tricks.
For further details look in MSDN under "Browser Extensions" they are -surprisingly- very well documented.
Peter Molnar
|
|
|
|
|
|
Which is the simplest way to terminate a dialog-based application?
|
|
|
|
|
1.The simplest is: clicking on the close button on the right upper corner with the mouse.
2.Second simplest: DestroyWindow() (from your app);
Peter Molnar
|
|
|
|
|
)Sorry, I missed some words in my question - I meant how one application can terminate another one...
|
|
|
|
|
|
Click the the X???
The word of the day is legs, let's go back to my house and spread the word
|
|
|
|
|
O, really? Thanks! It's my mistake I didn't ask the right question - what I meant was how one application can terminate another one.
|
|
|
|
|
I figured so...but the answer is fairly trivial, so I figured I'd just be a smart a$$ and let someone else tell you.
Cheers
The word of the day is legs, let's go back to my house and spread the word
|
|
|
|
|
if you know the title of that window, use this:
LPSTR name="the_window_title";
HWND hWnd = ::FindWindow(NULL,name);
::SendMessage(hWnd, WM_CLOSE, 0, 0);
|
|
|
|
|
The best way is to send WM_CLOSE message at any time
|
|
|
|
|
AfxGetMainWnd()->PostMessage(WM_CLOSE, 0, 0);
Fast.
Riccardo.
|
|
|
|
|
Is it possible to restart my dialog application from within or should I create an outside object to close it and then to start it again?
|
|
|
|
|
If your application lives just in an *.exe there isn't a possibility, but if in a *.dll there is.
You load your own .dll from an *.exe, when the *.dll attaches to the *.exe the reason for call in DllMain is DLL_PROCESS_ATTACH. Depending upon value of dwReason you can start your code.
If your process starts, your *.exe is shown in the task manager (with the *.dll linked to it), and it can be killed from there. In this case your DllMain gets called again with reason DLL_PROCESS_DETACH. From here you have to do a ShellExecute on your *.exe, and your process with the linked *.dll starts again.
Peter Molnar
|
|
|
|
|
You basically need two exe files, say, A and B. Now you want to restart A "within" A, you simply let A do the following:
1, Launch B via a call to ::ShellExecute .
2, Terminate itself.
At this point B has been launched and A has been terminated. Now, what B does are the following:
1, Wait a few seconds by using a timer. This is usually necessary because A may need some time to cleanup, i.e., de-allocate resources, clean files, whatever, etc.
2, Launch A via a call to ::ShellExecute .
3, Terminate itself.
So now your A is "restarted".
|
|
|
|
|
Yes, few solutions awailable:
1) External executable, when given control restarts app.
2) Create batch file that restarts application with flag delete on close,
execute it, and exit application.
3) Same executable, or new version of exec or exe making copy of itself, with when started with "reboot" command option, waits for executer to close, places itself into original directory, and re-starts itself.
I used to use (1), now I use (3) for self-update.
|
|
|
|
|
If I want to round my float so that automatically
3.45 ---- > 3.0 and 3.55---------->4.0 do I have to test (> 3.5 or < 3.5)and use a combination of ceil and floor? I couldnt find anything like a round() which might be able to decide automatically.
Thanks,
ns
|
|
|
|
|
Just put that comparison you mentioned in a function and name it round!
|
|
|
|
|
double d = 3.45;
int x = (int) (d + 0.5); // x is 3
...
d = 3.55;
x = (int) (d + 0.5); // x is 4
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|