|
the other method works only within a running program.
for you, use CFileFind or FindFirstFile and FindNextFile
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Sorry, I misunderstood you. If you have a name of an arbitrary .exe file and you have no idea where it is located, then the only way is (AFAIK) to scan the disk. You could use the MFC class CFileFind to find a file with a given name - you would have to supply in what folder to look, and you would have to recursively walk through all folders. Not a trivial task I believe...
If however the .exe in question is the .exe you are writing then you can use the code I showed you.
What exactly is your requirement, i.e. under what circumstances do you need to do this?
Wenn ist das Nunstück git und Slotermeyer? Ja! Beierhund das oder die Flipperwaldt gersput!
|
|
|
|
|
hi,
I want to execute some exes programatically using C++.using WinExe() Method I can execute any exes..But I want to know about the Full path for exes. I know the names of exes only.If I know the full path of exe ,I can execute the exe.
like::
WinExe("C:\\data\\xyz.exe",-----)
Thanks in advance.
|
|
|
|
|
|
Hellow,
I need to paint a scroll bar. I need to resize the thumb according to the data. So I cant use Bitmaps to create the thumb. Can any one help me ?
shijuck
|
|
|
|
|
Hi All,
I'm in need of painting scroll bar control(all the part of the scroll bar including the tump, up/down buttons). Pls suggest any of good strategies for it.
Thanks in advance
Anurag Velekkattu
|
|
|
|
|
Hello,
is there anybody to explain me how to disable an item from a menu ?
One of my items are for exemple ID__STOP :
in my .h file:
afx_msg void OnChoixMenuStop();
afx_msg void OnUpdateMenuStop(CCmdUI *pCmdUI);
and in my .cpp file :
BEGIN_MESSAGE_MAP(CAppDlg, CDialog)
ON_COMMAND(ID__STOP, OnChoixMenuStop)
ON_UPDATE_COMMAND_UI(ID__STOP, OnUpdateMenuStop)
END_MESSAGE_MAP()
void CAppDlg::OnContextMenu(CWnd* pWnd, CPoint point)
{
CMenu menu;
menu.LoadMenu(IDR_POPUPMENU);
menu.GetSubMenu(0)->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON,point.x, point.y, this);
}
void CAppDlg::OnUpdateMenuStop(CCmdUI *pCmdUI)
{
pCmdUI->Enable(FALSE);
}
I would like to get it grayed or disabled but i can't...
Please if you can help me it would be great !
There is no way to happiness, happiness is the way !
|
|
|
|
|
Your menu is created every time the OnContextMenu method is called, so you have to disable the button in OnContextMenu (using the EnableMenuItem method of CMenu before TrackPopupMenu) or in the resource file of your project.
|
|
|
|
|
Hello,
thank you for your answer, but the fact is that I want to modify the state of my items from OnUpdateMenuStop(CCmdUI *pCmdUI) and not from OnContextMenu(CWnd* pWnd, CPoint point).
I've just found the answer in the knowledge base of microsoft Q242577. My application is dialog based (CDialog) and this is the bad point... But the give in Q242577 the 'OnInitPopupMenu' which solve the problem !!!
I wish you a nice day,
alain
There is no way to happiness, happiness is the way !
|
|
|
|
|
Does anybody have an example of a CMM (Color Management Module). I am whating an exampe as a starting point to see if my ideas will work. I've looked all over the Web and MS web sites but no no avail.
With Thanks.
|
|
|
|
|
Ok. Here is a problem.
I try to find current resolution using EnumDisplaySettings function. Everything is ok, but when I run this function while playing game , it gives me old resolution used for desktop. For example. My desktop resolution is 1024x768x32. I start Zuma Deluxe, which switch resolution to 640x480x32. I wrote a small program which uses timer and every 2 seconds check current resolution and put it in memo control. Ok. I run program and see resolution is my desktop resolution. Now I run game (test program still active), playing for example 1 minute and then exit from game. Looking in memo control in my test program, no 640x480 in the list! Whole list containt 1024x768! Hmm, strange. So I assume that EnumDisplaySettings with ENUM_CURRENT_SETTINGS only show me resolution which was used as permanent (I this with CDS_UPDATEREGISTRY in ChangeDisplaySettingsEx function). But games change resolution temporarily! So how I can find current resolution regardless of mode of this resolution?
|
|
|
|
|
The problem you have encountered is that DirectX games do not go through the GDI in order to increase their speed.
When you use a call to the GDI function EnumDisplaySettings you get the current GDI settings and not the DirectX settings.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Walliams (Little Britain)
|
|
|
|
|
It doesnt work even for OpenGL applications.
So how I can find resolution?
|
|
|
|
|
No, OpenGL works in the same way as DirectX. They both have drivers that write directly to the video, bypassing the slow GDI.
Sorry I do not know how you could detect the resolution for either DirectX or OpenGL outside of the particular application itself.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Walliams (Little Britain)
|
|
|
|
|
Thats bad. I'm trying to create ScreenShot Maker and all I need is detect current resolution
Hmm, it seems that I have to do in on the hardware level .
|
|
|
|
|
I'm trying to run "Triangle" in Microsoft Visual C++. I define the NO_TIMER as its not a Linux system. It compiles and runs, giving a list of the commands I can use. Hitting any key just closes it down, with nothing else happening. How do I get it to create the proper file?
I ideally would like a C++ version of Triangle, so I can incorporate it in an existing project. Any links to information about this would be appreciated.
Keck
|
|
|
|
|
Hi
I have a dll that will be used simultaneously be different processes. The dll opens a database connection that is to shared among all the processes that used this dll. This is to avoid opening the database each time by each processes whenever they need something from the database.
I believe this can be done by sharing the virtual memory using VirtualAllocEx, WriteProcessMemory, ReadProcessMemory apis, is that correct ?
If so is this the correct approach ?
If not what is the best approach ?
Thanks in advance
Regards
The Best Relligion is Science.
Once you understand it, you will know God.
|
|
|
|
|
Hi there,
I have tried to get a dialog to transfer data from a combobox into the view class member but I havent been able to get it to work get crashes.
All I want is a tutorial on how to change som variables in a dialog that effects the members of the view class. This must be a ordinary thing that must want to achive. Every windows program has dialogs to set alot of options etc.
Hope you got something for me!.)
regards
Peter
|
|
|
|
|
Hi
I understand your problem is to accept user input through a dialog and get those data in the View class of a SDI/MDI, is that so ?
Then you could try doing this,
Insert a Dialog into the project.
Add the control you want on the dialog.
Now add a class CUserDlg for the dialog, deriving it from CDailog.
Add member functions like GetName, GetAge, GetGender etc to the CUserDlg, these should return the data that you want to pass to the view class.
Now create a memberf m_dlgUserData of type CUserDlg in the View Class.
Call DoModal to display the Dialog and when finished (ie pressed ok)
Call m_dlgUserData.GetAge(), to get the age of the user. This way you get the age of the user entered in the dialog into the View Class.
Hope I answered your question...
Regards
The Best Relligion is Science.
Once you understand it, you will know God.
|
|
|
|
|
The simplest way of transfering data between dialogs and views. Is to pass a pointer to the view class into the dialog class either via the constructor or via a method that is called before DoModal.
In the constructor, assign the view pointer to a class member variable and then you can call view methods in any of your dialog methods.
Michael
CP Blog [^]
|
|
|
|
|
Hi~
struct Score<br />
{<br />
LPWSTR studentName;<br />
int mark;<br />
Score(LPWSTR sn, int m){ studentName = sn; mark = m; }<br />
}<br />
<br />
Score s1("a",10);<br />
Score s2("b",20); <br />
<br />
Score *ptr = new Score[3];
<br />
ptr[0] = s1;<br />
ptr[1] = s2;
I would like to know what is the value of ptr[2]?
Thanks
|
|
|
|
|
ptr[2] is undefined. However under VC.NET in debug mode it is likely to be set to a junk value (0xCCCCCCCC), whilst in debug mode it could be anything.
It's best not to rely upon these values. If you need arrays that are correctly initialised to a default use a std::vector
std::vector<Score> scores;
scores.resize(3);
scores.at( 1 ) = Score("a",10);
scores.at( 2 ) = Score("b",20);
If you can keep you head when all about you
Are losing theirs and blaming it on you;
If you can dream - and not make dreams your master;
If you can think - and not make thoughts your aim;
Yours is the Earth and everything that's in it.
Rudyard Kipling
|
|
|
|
|
Hi
I feel you will get garbage. You must provide a default constructor for you sturture if you want to intialize the structure in this case.
Regards
The Best Relligion is Science.
Once you understand it, you will know God.
|
|
|
|
|
Would the new Score[3] create an array of 3 Score objects and use the default constructor? So the statements such as ptr[0] = s1; will use the default assignment operator to copy the objects?
ptr[2] will have garbage values because the default constructor is not provided.
|
|
|
|
|
Hello
I've wrote a program that printed Word documents using Word Automation and used GetPrinter, SetPrinter and DocumentProperties functions to change duplex and default bin settings of the printer.
Everything worked with HP Laserjet printers (HP Laserje 5M, for example), but it doesn't work with a new color CLJ3700 PS.
When I try to change printer settings all functions show that everything is OK, but when I print something it uses the preset settings
Can anyone tell me why is that happening?
Thank you in advance
|
|
|
|