|
Oh yeah, sorry
It seems like checking all the possibilities (security, writable device, etc) would be alot
more work than just checking the return from CreateFile().
Maybe there's an easier API - I don't know what it is.
Mark
"Great job, team. Head back to base for debriefing and cocktails."
(Spottswoode "Team America")
|
|
|
|
|
HI,
I would like to send a scroll message to Other app(like explorer.exe, IE, notepad.exe....) Using Code like this:::SendMessage(hwnd,WM_VSCROLL,SB_LINEDOWN,0);
It succeed in these APP, but when i try to send the message to MS WORD and OPERA, it failed.
Is this a MDI's reason, How can i solve this?
thanks.
|
|
|
|
|
worker thread did not survive the release version - MFC
in the debug version it did not clash and ran smooth, and completed the cyclesequence function
but it clashed badly in the release version. cyclesequence function was never completed
sry i am very bad in threading. i have search all over but cannot find the solution
ok here's how my program goes
when the user presses a button called "RUN" , i begin my thread
void COpc_serialDlg::OnRun() <br />
{ <br />
m_th_sequence = AfxBeginThread(th_start_sequence, (LPVOID)this );<br />
m_run.EnableWindow(FALSE);<br />
<br />
}<br />
my thread begins by obtaining information from editboxes and starts a function called CycleSequence
<br />
UINT COpc_serialDlg::th_start_sequence(LPVOID lpvParam)<br />
{<br />
COpc_serialDlg *th_start_receiving = (COpc_serialDlg*)lpvParam;
int times = 0;<br />
CString startstring = "";<br />
CString repeatstring = "";<br />
CString endstring = "";<br />
times = th_start_receiving->GetDlgItemInt(IDC_REPEAT_TIMES1);<br />
th_start_receiving->GetDlgItemText(IDC_STARTKEY1 , *startstring);<br />
th_start_receiving->GetDlgItemText(IDC_REPEAT1 , *repeatstring);<br />
th_start_receiving->GetDlgItemText(IDC_ENDKEY1 , *endstring);<br />
th_start_receiving->CycleSequence(times, *startstring, *repeatstring, *endstring);<br />
th_start_receiving->PrintRedDebugMsg( "Cycle thread exiting");<br />
th_start_receiving->m_run.EnableWindow(TRUE);<br />
<br />
return 0;<br />
}<br />
here's how CycleSequence function looks like
int COpc_serialDlg::CycleSequence(int times, CString startstring, CString repeatstring, CString endstring)<br />
{<br />
<br />
CString temp_string = "";<br />
int i = 0;<br />
int Stroke_Count = GetNumberOfStrokes( startstring);<br />
CString local_repeatstring = "";<br />
CString local_repeatstring2 = "";<br />
<br />
<br />
<br />
for( i = 0 ; i < Stroke_Count ; i++)<br />
{<br />
<br />
local_repeatstring = startstring;<br />
<br />
<br />
m_serial.Write(Read_Out_Int(local_repeatstring),1,0,0,10);
startstring = Remove_Out_Int(startstring);<br />
<br />
SetTimer( 999 , 15000 , NULL);<br />
WaitForSingleObject(m_idle_event , INFINITE);
<br />
}<br />
<br />
Stroke_Count = GetNumberOfStrokes( repeatstring);<br />
for( i = 0 ; i < times ; i++)<br />
{<br />
local_repeatstring = repeatstring;<br />
for( int j = 0 ; j < Stroke_Count ; j++)<br />
{<br />
local_repeatstring2 = local_repeatstring;<br />
ResetEvent(m_idle_event);
<br />
<br />
PrintRedDebugMsg( "Waiting done");<br />
m_serial.Write(Read_Out_Int(local_repeatstring2),1,0,0,10);
local_repeatstring = Remove_Out_Int(local_repeatstring);<br />
<br />
SetTimer( 999 , 15000 , NULL);<br />
WaitForSingleObject(m_idle_event , INFINITE);
<br />
}<br />
}<br />
<br />
Stroke_Count = GetNumberOfStrokes( endstring);<br />
<br />
<br />
<br />
for( i = 0 ; i < Stroke_Count ; i++)<br />
{<br />
<br />
local_repeatstring = endstring;<br />
<br />
<br />
m_serial.Write(Read_Out_Int(local_repeatstring),1,0,0,10);
startstring = Remove_Out_Int(startstring);<br />
<br />
SetTimer( 999 , 15000 , NULL);<br />
WaitForSingleObject(m_idle_event , INFINITE);
<br />
}<br />
PrintRedDebugMsg( "End of cycle reached");<br />
return 0;<br />
}
there are also other functions in CycleSequence like m_serial.Write , Remove_Out_Int and Read_Out_Int and GetNumberOfStrokes
i did not include them here because i dont think they are causing the problem.
i believe the problem is the way i initalize stuff in cyclesequence and the way i do my loops
using:
- winxp
- VC++ 6.0
- MFC
|
|
|
|
|
Function UINT COpc_serialDlg::th_start_sequence(LPVOID lpvParam) must be static
|
|
|
|
|
awah wrote: there are also other functions in CycleSequence like m_serial.Write , Remove_Out_Int and Read_Out_Int and GetNumberOfStrokes
i did not include them here because i dont think they are causing the problem.
Not necessary. Its very difficult from seeing this code, to find out the problem.
You can put down message boxes in code and narrow down the rpblem code.
Additionally , refer this article by Joseph M. NewComer Joseph M. NewComer[^].
|
|
|
|
|
awah wrote: my thread begins by obtaining information from editboxes
Well, this is a definite no-no from worker threads.
Never touch the GUI from a worker thread, it may cause a deadlock.
Read Joe Newcomer's article on the subject to get a better understanding of how to do worker threads here[^].
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Just opened the readme to VseDebug it says it works with
Visual studio.net 2002 2003 Anyone know if you can build it With Visual Express 2005
|
|
|
|
|
The following code on a linux gcc compiler gave me an error message:
error - SO C++ forbids declaration of "vector" with no type
apparently,
vector <double> dd; is okay because double is a known type
How can I make g++ recognize t_vertice as a valid type?
Or how can I switch off the ISO compatibilty on the g++ compiler?
_________________________________________________
#ifndef HSI3D_H
#define HSI3D_H
#include <qgl.h>
#include <vector>
#include <iostream>
#include "../imageplus.h"
#include <qimage.h>
class HSI3D : public QGLWidget
{
Q_OBJECT
public:
HSI3D(QWidget *parent=0, const char *name=0);
HSI3D(const ImagePlus &Image, QWidget *parent=0, const char *name=0);
~HSI3D();
typedef struct t_vertice{
uchar red;
uchar green;
uchar blue;
float h;
uchar s;
uchar i;
}t_vertice, *ptrtvertice;
vector <t_vertice> puntos;
int quants_punts;
-- modified at 0:02 Thursday 1st March, 2007
|
|
|
|
|
Can modify your code with ignore html tags option ? So that it can be readable, understandable.
|
|
|
|
|
George Lam wrote: typedef struct t_vertice{
uchar red;
uchar green;
uchar blue;
float h;
uchar s;
uchar i;
}t_vertice, *ptrtvertice;
I've never worked on linux.
But, just a suggestion. Can you try, moving this typedef outside the class ?
|
|
|
|
|
no go, still same error message
|
|
|
|
|
I've never used gcc but searching on the error message it seems the likely culprit is
"vector" is not defined, usually because of a missing header or a namespace problem.
If you have the right header(s) included, maybe "std::vector" will work.
std::vector <t_vertice> puntos;
or
using std::vector;
...
vector <t_vertice> puntos;
Mark
-- modified at 14:32 Thursday 1st March, 2007
|
|
|
|
|
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
|
|
|
|