|
hi guyz,
im still new to vc++ and currently migrating from visual basic to visual c++,
I need your help, how do I keep my dialog to be always on active state? wherein the alt tab or lost focus is disabled and keep my dialog always active...
thanks
-- modified at 21:40 Wednesday 28th February, 2007
|
|
|
|
|
AttachThreadInput() and set window by SetFocus().
sample:
<br />
BOOL SetWindowActive(HWND hActivedApp)<br />
{<br />
HWND hWnd = NULL;<br />
hWnd = GetForegroundWindow();<br />
DWORD FormThreadID = GetCurrentThreadId();<br />
DWORD CWndThreadID = GetWindowThreadProcessId(hWnd, NULL);<br />
if(FormThreadID != CWndThreadID )<br />
{<br />
AttachThreadInput(CWndThreadID, FormThreadID, true);<br />
}<br />
<br />
if( ::IsWindow(hActivedApp) )<br />
{<br />
SetFocus(hActivedApp);<br />
return TRUE;<br />
}<br />
<br />
if(FormThreadID != CWndThreadID )<br />
{<br />
AttachThreadInput(CWndThreadID, FormThreadID, false); <br />
}<br />
return FALSE;<br />
}<br />
|
|
|
|
|
Do I call this function on the oninitdialog function or other events?
thanks for the code....
|
|
|
|
|
any time except in hook proc.
|
|
|
|
|
App a is running in focus painting the Window Banner with progress counts, when an email notice pops
up...after that the running app doesn't paint the window anymore even though it runs to completion...same thing happens when you minimize the running apps window...is there an easy gracefull way to solve this... I've tried 'invalidating ' stuff but its jerky and seems very inefficient...thanks in advance.
|
|
|
|
|
Are you drawing in response to WM_PAINT?
Are you preventing the UI thread from processing WM_PAINT messages?
Mark
"Great job, team. Head back to base for debriefing and cocktails."
(Spottswoode "Team America")
|
|
|
|
|
Hmm... I'm actually letting the virtual onpaint do the painting....how can I detect if I am preventing the UI thraed from receiving the msg....this whole thing seems like it ought to be trivial....i just want the original window to repaint after having been overwritten/minimized....how do other apps do this...thanks.
|
|
|
|
|
OnPaint is virtual? I thought there needed to be a message map entry for WM_PAINT for the window
class.
Anyway, if your painting works fine when you don't do any lengthy processes in the background, but
when you have something going on in the background it stops painting then that probably means
your message loop is tied up.
Possible ways to correct this are:
1) do lengthy operations on a separate thread
2) Periodically pump all messages from the message queue while doing a lengthy process on the UI
thread.
3) Use Invalidate()/UpdateWindow() to force an instant WM_PAINT message (bypassing the queue)
(this doesn't really help in your case because you don't know when you need to repaint).
It should be trivial, yes, but not if you're UI thread is off doing something else
Mark
"Great job, team. Head back to base for debriefing and cocktails."
(Spottswoode "Team America")
|
|
|
|
|
Hello everybody im getting an error that says LPENUM_SERVICE_STATUS pess = malloc(cbBytesNeeded); cannot be converted from void * to LPENUM_SERVICE_STATUS. This code is very old and I know 100% it worked with my old C compiler. Any help would be appreciated. Using VC++ 7 and windows XP. Thanks in advance
|
|
|
|
|
Try this:
LPENUM_SERVICE_STATUS pess = static_cast<LPENUM_SERVICE_STATUS>(malloc(cbBytesNeeded));
Steve
|
|
|
|
|
Hi All,
I would like to find out if there any way to change the path for the swap(pagefile.sys) file. In particular i want to be able to change the partition in which the pagefile resides.
Is there a sample code, blogs, article or function can I see?
Thanks,
|
|
|
|
|
Programmatically? Maybe using WMI (see the Win32_PageFileSetting[^] class).
Mark
"Great job, team. Head back to base for debriefing and cocktails."
(Spottswoode "Team America")
|
|
|
|
|
I have dialog in MDI with a simple text box that i want to change and update the text when a button is clicked. I I can't remember how to update the text box. I have the following code for the button press.
void CNeuralNetTwoView::OnBnClickedButton1()<br />
{<br />
<br />
UpdateData(true);<br />
ScottsTextBox = "JERNIE CORPORATIONS";<br />
<br />
ScottsTestBoxCtrl.UpdateData(true);<br />
<br />
UpdateData(true);
<br />
UpdateData(FALSE);
<br />
}<br />
Scott Dolan
Jernie Corporation
Engineering & Manufacturing
Software, Hardware, & Enclosures
|
|
|
|
|
Assuming ScottsTextBox is a CString associated with the control (using DDX)...
void CNeuralNetTwoView::OnBnClickedButton1()
{
ScottsTextBox = "JERNIE CORPORATIONS";
UpdateData(FALSE); // Transfer data from variables to controls
}
or maybe ...
ScottsTestBoxCtrl.SetWindowText("JERNIE CORPORATIONS");
"Great job, team. Head back to base for debriefing and cocktails."
(Spottswoode "Team America")
|
|
|
|
|
i want to start a video in a powerpoint slide how can i do?
i tried sending mouse click into the video, however it is not working
mouse_event, sendinput, sendmessage, peekmessage... all of these functions don't work to send click into video
Please write what ever you know to solve my problem
|
|
|
|
|
You've posted this to every board I have visited. Please don't. If you're using VB, what will you do with an answer in C+ ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
because it is not important for me, i can change codes into my system
i want to get any idea or solution who knows
|
|
|
|
|
It's important to us that you don't spam the entire site.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Christian Graus wrote: You've posted this to every board I have visited.
Even the PowerPoint board?
"Great job, team. Head back to base for debriefing and cocktails."
(Spottswoode "Team America")
|
|
|
|
|
I cant get the program to display it appears then dispears very quickly.
someone please help
heres the code:
//Please someone help
#include <iostream>
#include <string>
using namespace std;
class Critter
{
//make following global functions friends of the Critter class
friend void Peek(const Critter& aCritter);
friend ostream& operator<<(ostream& os, const Critter& aCritter);
public:
Critter(const string& name = "");
private:
string m_Name;
};
Critter::Critter(const string& name):
m_Name(name)
{}
void Peek(const Critter& aCritter);
ostream& operator<<(ostream& os, const Critter& aCritter);
int main()
{
Critter crit("Poochie");
cout << "Calling Peek() to access crit's private data member, m_Name: \n";
Peek(crit);
cout << "\nSending crit object to cout with the << operator:\n";
cout << crit;
return 0;
}
//global friend function which can access all of a Critter object's members
void Peek(const Critter& aCritter)
{
cout << aCritter.m_Name << endl;
}
//global friend function which can access all of Critter object's members
//overloads the << operator so you can send a Critter object to cout
ostream& operator<<(ostream& os, const Critter& aCritter)
{
os << "Critter Object - ";
os << "m_Name: " << aCritter.m_Name;
return os;
}
|
|
|
|
|
Run it from a command prompt (instead of double-clicking it frm within Windows Explorer).
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
How would i do that can u show an example??? Please.
|
|
|
|
|
Spartan16 wrote: How would i do that...
It's hard to fathom that you might actually be serious.
Click Start
Click Run
Type cmd
Click OK
Now change to the folder where your program resides and run it from there.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
lol of course i know how to run cmd. but in cmd what do i type to run the program thats all i am asking.
|
|
|
|
|
Spartan16 wrote: ...in cmd what do i type to run the program...
Whatever the name of your program is.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|