|
Hi
Does anyone know how to output messages to the debug window in the VC++ IDE.
Thanks in advance.
|
|
|
|
|
Look up the TRACE macro and the OutputDebugString function.
Steve
|
|
|
|
|
ragavan wrote: Does anyone know how to output messages to the debug window in the VC++ IDE.
TRACE0 to TRACE10
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Hi all,
I am developing an On-Screen keyboard as part of my graduation project, I want the program to send a keystroke event to the active window (when I click on that key using a mouse).
My problem:
When I click on the key image, say G, I get the active window and send the key to it, but the active window (after the click event) is my programs window (it was activated because of the click on the letter G), so how can I get the previous active window or prevent my window from ever being activated???
Please its urgent,
Thank you!!!
And ever has it been that love knows not its own depth until the hour of separation
|
|
|
|
|
any help, please?
And ever has it been that love knows not its own depth until the hour of separation
|
|
|
|
|
Mohammad A Gdeisat wrote: how can I get the previous active window or prevent my window from ever being activated
To answer the last question first, you can't, not without a lot of kludging. As for how to get the previous active window, what happens if there is a popup that the user must respond to, before clicking on the keyboard? This is non-deterministic, and it seems to me that a better way would be to invoke the on-screen keyboard (dialog, exe, whatever) with the HWND of the window that wants the key presses. If a dialog, pass the HWND as a parameter. If an exe, pass the HWND as a string parameter on the command line. That way you will know for sure where to send the click events.
Best wishes,
Hans
|
|
|
|
|
hi i have to run a thread when a button say ok is clicked. if the user press cancel threading should be exited. should not close the dialog. how to do this.
Arise Awake Stop Not Till ur Goal is Reached.
|
|
|
|
|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Threading;
namespace testApp
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
Thread newThread;
private void btnOK_Click(object sender, EventArgs e)
{
newThread = new Thread(new ThreadStart(Display));
newThread.IsBackground = true;
newThread.Start();
}
private void Display()
{
MessageBox.Show("threadStarted");
}
private void btnCancel_Click(object sender, EventArgs e)
{
newThread.Abort();
MessageBox.Show("threadstopped");
}
}
}
My small attempt...
|
|
|
|
|
This is managed code, we are on the C++ forum.
|
|
|
|
|
Your code needs to a convertor to convert of managed code to unmanaged code
|
|
|
|
|
oh what reverse process
"Success lies not in the result , But in the efforts !!!!!"
Amit Mistry - petlad -Gujarat-India
|
|
|
|
|
Its simple if you know managed programming you can convert it
|
|
|
|
|
WhiteSky wrote: if you know managed programming you can convert it
if not!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Its simple if not you can try to learn it
|
|
|
|
|
WhiteSky wrote: Its simple if not you can try to learn it
he he
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Of course I know you are a good programer and its not difficult for you
|
|
|
|
|
WhiteSky wrote: Of course I know you are a good programer and its not difficult for you
my Project lead don't think so [ ];P.. and i am making him to believe that
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
dude it's unmanaged forum!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Change the Id of the button to something else than IDCANCEL. That will solve the part concerning the closing of the dialog.
Concerning stopping the thread, it depends of your code. Is the thread running an 'infinite loop' ? (something like while(true) ). If yes, then you can check for a boolean and set this boolean to false when you press the button.
|
|
|
|
|
Hi,
Keep two buttons. One OK and another Cancel on the dialog. Keep a member variable in the dialog class of type CWinThread* say m_pThread. Now
create the thread in the OnOK() event handler as
m_pThread=AfxBeginThread(ThFunc,0,0); where ThFunc is the function pointer to your thread controlling function and the next argument is the argument passed to your function which I have passed 0 here. This function should be of type UINT YourThreadFunc(LPVOID pParam).
To stop execution of the thread write in the OnCancel() event handler
m_pThread->SuspendThread();
Hope this will help you.
Barna
|
|
|
|
|
Bad advice. See here[^] for details.
Steve
|
|
|
|
|
If you can come up with some good advice and a real solution to the actual problem then put it there.
Barna
|
|
|
|
|
My advice was valuable: pointing out unsafe solutions is a valid point to make.
Steve
|
|
|
|
|
The point is to get a solution to the actual problem posted. Do that.
Barna
|
|
|
|
|
Look dude, I just pointed out that your solution was bad. This took me 5 seconds and one line of text. I post heaps of messages on this forum and make an effort to be helpful – when time permits. Now I’m sorry if you’ve been offended but nevertheless my post has merit and is informative. Perhaps not as immediately useful as a full solution: but knowing what not to do should not be underrated. Perhaps it’s taught you something for example.
Steve
|
|
|
|