|
Hi.
Your question isn't quite clear. For one, why do you want to delete that file programatically, what you say suggests you simply want to delete a file, so locate it in windows explorer, right click it and select "Delete". You shouldn't have the need to write a program for that. For two, GetAllUsersProfileDirectory[^] simply gives you the path to the "All Users" folder, it doesn't delete anything, but i will assume you know that and you are simply asking how to use this function, something like this (not tested, error checking ommited):
DWORD charsNeeded;
GetAllUsersProfileDirectory(NULL, &charsNeeded);
TCHAR *FolderPath = new TCHAR[charsNeeded + 1];
GetAllUsersProfileDirectory(FolderPath, &charsNeeded);
... the path should be in the FolderPath buffer now, do whatever you want with it...
delete []FolderPath;
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> "It doesn't work, fix it" does not qualify as a bug report. <
> Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <
|
|
|
|
|
Hi,
I need to use _contolfp_s function in vc6 to set the floating point control word.
I have already used _controlfp and it is working fine
#include "float.h"
_controlfp(_CW_DEFAULT, 0xFFFFF);
but it seems this is deprecated function and I have to use the new _contolfp_s.
But using this _contolfp_s gives an error undelared identifier as it is checking in the path
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\float.h
I have to Include the below path for my vc6 application
C:\Program Files\Microsoft Visual Studio 8\VC\include\float.h
Where should I Include this?
Thanks
Satya
Today is a gift, that's why it is called the present.
|
|
|
|
|
I haven't used it in years but I doubt VC6 has an implementation of _controlfp_s. Just keep using _controlfp and everything should works swimmingly.
Looking at the error message it looks like you've got VC++ 7.1 installed as well and VC6 is picking up the paths. VC6 and later don't exist together too well so it might be worth isolating them on different computers or virtual machines.
Cheers,
Ash
|
|
|
|
|
Dear all:
I know that I can control the NB screen brightness by using WMI. But it seems that I cant use WMI to change the screen contrast. So if I want to do this work, how can I do it? Can I do it with DirectX?
|
|
|
|
|
Hello,
I need to check that whether a given binary is a valid PE file (Perhaps might some one can rename java file/class file or .js/html files to .exe or .DLL ). In this case i suspect that e_magic field of FileHeader structure would tell this..
or any other field will let the user know about the validity of PE file?
Regards
Usman
|
|
|
|
|
Am not sure if this is what you are looking for or not but here[^] they say:
Old MS-DOS .exe files and the newer Microsoft Windows PE (Portable Executable) .exe files start with the ASCII string "MZ" (4D 5A), the initials of the designer of the file format, Mark Zbikowski. The definition allows "ZM" (5A 4D) as well, but this is quite uncommon.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> "It doesn't work, fix it" does not qualify as a bug report. <
> Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <
|
|
|
|
|
The PEF specification is a large set of rules that must be obeyed. Obeying some of them is insufficient to be a valid EXE file. So you could check a few of those rules to rule out the obvious violators, you would have to check everything to be absolutely sure it is a real EXE though.
If all you want to do is discard some obvious non-EXE files, look at the first two bytes, and a couple of the header bytes such as the e_magic field.
|
|
|
|
|
HI sir,
How can i get handle of another window.
I am tryiong to send a message to static text box,which is in another window,how can i do it.
I am trying with this.
I have 2 window example (a) and (b)
n a.h
I am doing as
extern HANDLE hwnd;
in b.cpp
HANDLE hwnd;
and using this function to display the message
SetDlgItemText(hwnd,IDC_STATIC1,"ds");
But the the handler is not coming here.
what changes i have to do,please let me know.
Thanks
Raj
|
|
|
|
|
You may use such global (there are better ways, I believe), however you have to properly initialize it at runtime.
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]
|
|
|
|
|
Have you intitalised hwnd to the handle of the text box? Perhaps if you show some more of your code it will become clear.
It's time for a new signature.
|
|
|
|
|
Richard MacCutchan wrote: Have you intitalised hwnd to the handle of the text box?
This is what i am doing.
I have created one dialog based application(say Test)
In that dialog,i have added one static text box(IDC_MYSTATIC).
From that dialog i am invoking another dialog(say Test1).
In that dialog,i have added a button as(Display message).
My plan is when i click that button.I want to display some msg on
(Test) dialog.
So what i am doing is:
IN Test.h.
extern HANDLE hwnd;
Then in second dialog.
In Test.cpp
HANDLE hwnd
Then on
DisplayMesage()
{
SetDlgItemText(hwnd,IDC_MYSTATIC,"ds");
}
I dont know whethier i am passing handle correctly or not.
I am getting hwnd as NULL
Thanks
Raj
|
|
|
|
|
If your code shows the actual runtime flow then hwnd is not initialized when you call SetDlgItemText .
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]
|
|
|
|
|
Well you have answered my question with "no", so it is no surprise that it does not work. The value of hwnd must be the handle to the window containing the item that you are trying to set the text of. Defining a variable in a header file has no effect on this, you need to get its value from within your Test1 dialog. I would guess (if you are using DoModal() to run Test1) that the correct value can be found from the GetParent()[^] function.
Perhaps a bit more time studying the basics of Windows Programming (Charles Petzold[^] has written some excellent guides) would be useful.
It's time for a new signature.
|
|
|
|
|
Hi All,
I have a form view. I want to display this SDI to Half (Left)of the screen.
Again I have another form view. I want to display this SDI to Half (Right)of the screen.
How to do?
I have changed the CREATESTRUCT structure.
but it is not working.
Any idea.
|
|
|
|
|
You can use SetWindowPos() on your AfxGetMainWnd() after it has been created in your CApp::InitInstance()
|
|
|
|
|
OK SetWindowPos is working thank you.
|
|
|
|
|
You should go for splitter window.
See this sample SDI with split window[^]
Added: Are you talking about two different applications?
|
|
|
|
|
Although Niklas post is correct I should recommend to consider a better design.
Unless you are developing something very specific (like a process plant control synoptic) you should not manage how your window(s) appear on the user screen. You are not the owner of the user environment and the user may also have other application running, may be even more important (or less, depends on the circumstances) than your, and will perceive your popping out at the placement you decide as a sort of ... invadence.
Consider, instead, a different design where a single frame window contains two children (your actual windows), may be either managed through a splitter or with fixed proportional positions.
You decide how the children fits the parent, but let the user free to place the parent in his own screen.
2 bugs found.
> recompile ...
65534 bugs found.
|
|
|
|
|
Hi All,
I am hooking the ExtTextOutW to capture data before it is displayed on the screen. I use Detours and created a dll and I inject it into an application before it starts.
The hooking works as expected, the problem I face is in the string parameter that is passed to the ExtTextOutW function.
When I log the value of this string to a file, it prints some garbled values. I have been trying to find out why this happens and I found out that it is due to glyphs, fonts and unicode.
The application I want to hook will use only English characters, so I want to convert the glyph values into regular characters so that I can log the English characters that is to be displayed on the screen and not some garbled values that come in the string parameter.
I searched on the internet and I came across a post on this forum
http://www.codeproject.com/Messages/446094/Re-Could-not-hook-proc-CreateWindowExA.aspx[^]
Right now I am unable to purchase the book, so can someone please tell me how I can accomplish converting glyph to a string as Ivo Ivanov as mentioned. Ivo Ivanov, if you are reading this can you please help me.
Thanks,
mich
|
|
|
|
|
Try posting your question in the forum at the end of the article and the author will be notified.
It's time for a new signature.
|
|
|
|
|
hi, I am new to VC++ MFC, i am trying to create a simple app. using MS Visual Studio 2005.
i want to move three button to scroll left when i click the left button, same if i click the right button, it should scroll right. then it will stop if i click the center button.
but i don't know how to start the code part, all did was to create the GUI.
the Design looks like this..
Check URL to view ScreenShot.
http://h1.ripway.com/lgmanuel/Imgs/gui.png
modified on Wednesday, July 14, 2010 5:04 AM
|
|
|
|
|
|
thank you for that info., but i am a total new to VC++ MFC,.
where do i put the code. should i just double click the button and add the code like Visual Basic do?
|
|
|
|
|
|
You should really buy a book about VC++. It is nearly impossible to help someone who has almost no knowledge of VC++ or C++ through a forum. It will take ages to explain some basic concepts. You will be much more efficient by reading a book first.
|
|
|
|