|
THx Moonen,
i solved my problem but not exactly how u explained, i got an idea on "DoModal will 'block' until the dialog box is closed", i wrote the same code before domodal();
and it worked.
Thx again.
|
|
|
|
|
Hi,
is it possible to change the Threadname of a Thread that was created with "AfxBeginThread()"?
In C# it is quite easy, but i couldn't find out a method for C++/MFC. It would be nice to read the correct threadname in the debuggerwindow. Right now it always tells me: "The Thread 'Win32 Thread' finished with code 0 (0x0).".
Thanks,
Snow
|
|
|
|
|
<br />
<br />
<br />
#pragma once<br />
<br />
extern "C"<br />
void WINAPI SetCurrentThreadName(<br />
LPCTSTR szThreadName<br />
);<br />
<br />
extern "C"<br />
void WINAPI SetThreadName(<br />
DWORD dwThreadID, <br />
LPCTSTR szThreadName<br />
);<br />
<br />
<br />
<br />
#include "stdafx.h"<br />
#include "SetThreadName.H"<br />
<br />
#define MS_VC_STN_EXCEPTION 0x406d1388<br />
<br />
#pragma pack( push, PPSetThreadName)<br />
#pragma pack( 4 )<br />
<br />
typedef struct _SETTHREADNAMEINFO<br />
{<br />
DWORD dwType;
LPCSTR szName;
DWORD dwThreadId;
DWORD dwFlags;
<br />
} SETTHREADNAMEINFO;<br />
<br />
#pragma pack( pop, PPSetThreadName )<br />
<br />
extern "C"<br />
void WINAPI SetCurrentThreadName(<br />
LPCTSTR szThreadName<br />
){<br />
DWORD dwThreadId = GetCurrentThreadId();<br />
SetThreadName(dwThreadId, szThreadName);<br />
}<br />
<br />
extern "C"<br />
void WINAPI SetThreadName(<br />
DWORD dwThreadId, <br />
LPCTSTR szThreadName<br />
){<br />
if( IsDebuggerPresent() ){<br />
<br />
SETTHREADNAMEINFO STNInfo;<br />
TCHAR szTempName[10];<br />
<br />
ZeroMemory(&STNInfo, sizeof(SETTHREADNAMEINFO));<br />
<br />
ZeroMemory(szTempName, sizeof(szTempName));<br />
lstrcpyn(szTempName, szThreadName, 9);<br />
<br />
STNInfo.dwType = 0x1000;<br />
STNInfo.szName = szTempName;<br />
STNInfo.dwThreadId = dwThreadId;<br />
STNInfo.dwFlags = 0;<br />
<br />
TCHAR szMessage[512];<br />
wsprintf(szMessage, "Setting thread 0x%08lx name to '%s'", dwThreadId, szTempName);<br />
OutputDebugString(szMessage);<br />
<br />
__try<br />
{<br />
RaiseException( MS_VC_STN_EXCEPTION, <br />
0, <br />
sizeof(STNInfo) / sizeof(DWORD),<br />
(DWORD *)&STNInfo);<br />
}<br />
__except (EXCEPTION_CONTINUE_EXECUTION)<br />
{<br />
}<br />
<br />
}<br />
}<br />
<br />
<br />
|
|
|
|
|
|
Thanks thats what i wanted
|
|
|
|
|
every time Button1 is click, the value of CPU's program counter is read and displayed on edit box1.
Then Button2 is click, the value of CPU's program counter is read and displayed on edit box2.
My purpose is to measure how long the device reponds to computer's command.
Cheers.
MilkyWay
|
|
|
|
|
Im having problem displaying pop-up menu
i only get the beginning of a menu and submenus
i did screenshoots of that but i cant post them so i'll use ASCII
like this:
╔╗
||
||
||
|| ╔--------╗
|| |submenu|
|| ╚--------╝
||
||
╚╝
(that vertical rectangle loks like border between splitter windows and between it and the submenu is the exact amount of space as it should be for text "menu 3" to fit)
where it should be like this:
╔-------╗
|menu 1|
|-------|
|menu 2|
|-------|╔--------╗
|menu 3>|submenu|
|-------|╚--------╝
|menu 4|
╚-------╝
first i load menu in CMenu in OnInitialUpdate():
m_popUpMenu.LoadMenu(IDR_POP_UP_MENU);
then i use pop up OnRightclick()
m_popUpMenu.TrackPopupMenu(TPM_LEFTALIGN, point.x, point.y, this);
any help will do
thank you
|
|
|
|
|
hi all!
I have a problem with my directsound application.Every time i play my sound and if there is another application playing(e.g windows media player) i get corupted sound.My cooperative level is DSSCL_PRIORITY. I also have problem when trying to create DirecSound object with CoCreateInstance metod.Curently i am creating it with DirectSoundCreate metod.
Anyone have some experience with this?
Many thanks!
|
|
|
|
|
Environment: XP Pro SP2, VS.Net2003
I am setting up some context menu items that have shortcut keys associated to them. The shortcut keys are: Shortcut::CtrlShift0 to Shortcut::ChrlShift9. This how I implement it:
for( i=0 ; i<10 ; ++i )
{
miShortcuts[i]->Index = i ;
miShortcuts[i]->Text = String::Concat(S"Shortcut ", i.ToString() ) ;
miShortcuts[i]->Shortcut = static_cast<shortcut>(*dynamic_cast<shortcut *="">(Enum::Parse(__typeof(Shortcut), String::Concat(S"CtrlShift",i.ToString())))) ;
miShortcuts[i]->Click += new System::EventHandler( this, MenuItem_Shortcut_Click ) ;
}
When I compiled it, I got this error:
error C2440: 'static_cast' : cannot convert from 'System::Enum' to 'System::Windows::Forms::Shortcut'
I have tried many things but I keep ending with similar error messages. Your help is appreciated.
Thanks!
|
|
|
|
|
Hi all,
I'm seeking a class/module to help with the filtering of some data.
Things like Butterworth or Chebyshev filters, all fairly standard stuff I'm sure.
Problem is I can't seem to find any code out there?
Can you help point me in the right direction?
Cheers
--
The Obliterator
|
|
|
|
|
If you are finding nothing that can help you, you could try to implement FIR and IIR filters (quite easy). And then use programs like Matlab to know the impulse responce af a particular filter as 'Butterworth' or 'Chebyshev' and implement it with a FIR.
Matteo
|
|
|
|
|
first you need code to do FFT (Google "FFT Bourke").
then you need some code to do a filter on the FD data (Google "Butterworth Filter FFT").
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
Is it possible to take controll to the Microsoft document and enter text and make any changes?
I need to remove the flag that make you see the changes you have made. Is that possible to do? and if so how?
|
|
|
|
|
Which document ? Which changes ?
You mean opening a word document with your program and modify its content ? If this is the case, look for word automation.
|
|
|
|
|
how to use CFileDialog to save a file??
vj
|
|
|
|
|
vijayganesh wrote: how to use CFileDialog to save a file??
You cannot use CFileDialog to save the File, you have to implement you logic for that.. But you can open it in Save As mode by specifying FALSE in construtor while creating CFileDialog object..
like this
CFileDialog dlg(FALSE);
"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
|
|
|
|
|
ya tried it out with it.. but i am not abl to get th file name from the user....
|
|
|
|
|
HI!!!
I am working on an MFC Application. When I view the class wizard an error occurs which is:
Parsing Error: Expected ";"
Input Line: "void Convert(CString str1,CString str2);"
I had checked the application. But, I didn`t understand the cause for this type of error. Wat may be the problem? Wat should I do?
Thanx a lot
"If you change then change for the good."
|
|
|
|
|
You probably edited something wrapped into AFX.... 'tags'. Post the code where this error occurs (the complete file if this is small file)
|
|
|
|
|
Hi,
compiler: VC++ 6.0
problem:
When a Release Build is done, it works fine..
We are using MSXML 6.0 in our code.
But during Debug Build of a win32 module, it gives the following error.
msxml6.lib(msxml6_i.obj) : fatal error LNK1103: debugging information corrupt; recompile module
Error executing link.exe.
One possible reason we could think of is the msxml6.lib is of release build. so it builds on release mode and gives the error on debug build
We need a Debug build since we need to debug the code, can anybody suggest any work around in the compiler setting..
I tried out the following
try out the following, but no use:
Turn off optimization with the /Od (Disable) option.
Disable minimal rebuild with the /Gm– (Enable Minimal Rebuild) option.
Compile with the /Gy (Enable Function-Level Linking) option to package functions.
Use a different code generation option. See the /G (Optimize for Processor) options.
Change the order of functions and global variables.
I get the same error when I enable the Debug option of compiler in Release Mode.
Any suggestion or workaround is highly appreciated.
Thanks,
Shiva
|
|
|
|
|
aren't you trying to debug a dll which was compiled in release mode ?
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
hi,
i'm using GDI+ in a MFC based App under Visual Studio .NET and have a problem with the Bitmap class.. if i use the following code in some drawing function, it work's perfectly well (although slow, cause of the steady reloading of the image, which is crap..)
void DrawSomething(Graphics *g) {
Bitmap myBitmap(L"somepicture.png", false);
g->DrawImage(&myBitmap, RectF(somecoordinates));
}
now i'd like to keep the Bitmap object resident, by adding static in fron of the Bitmap declaration, or some new/delete construct in the embedding class, but in every case my Bitmap(-Object?) seems to be lost.. no error, no display of the image!? even Bitmap::GetHeight() returns 0 in that case, without crashing.. .NET framework issue? but it's unmanaged code, so garbage collection should not happen..
any ideas??
regards
olli
|
|
|
|
|
hi all..
i need a small help.. i am developing an application in vc..
Which is similar to that of MS Paint application.. that is my application..
contains free hand diagram in view window then drawing using dilaog box for..
getting Co-ordinate for the diagrams such as line,rectangle, circle.. now i need a save option in the file menu as well open option.. i used CMetaFileDC.. but its not working for graphics.. plz help me out how to save the view window document and retrive it back by using open...
Thanks in Advance...
vj
|
|
|
|
|
I am not sure how well this could perform, but this will work. You may read the information pixel by pixel and store it into a file. Say, XY(31,45)=RGB(132,53,90); and while opening a file, you could read this file and paint accordigly. I know this is a very crazy way of doing it, but may be a temporary solution for you.:->
Rajesh R. Subramanian
Akruti Software,
Bombay, India.
You have an apple and me too. We exchange those and We have an apple each.
You have an idea and me too. We exchange those and We have two ideas each.
-- modified at 7:28 Tuesday 29th November, 2005
|
|
|
|
|
The Worker Thread in my MFC SDI Application does some heavy job.
The user can stop in between by pressing the <stop> toolbar button or Tools menu -> Stop.
To enable the Stop toolbar button before the control enters the worker thread, i have used the following line of code:
pApp->bDiskReadProcessStarted = TRUE;
pframe->pToolBar->SendMessage(TB_ENABLEBUTTON,ID_TOOLS_STOPCURRENTPROCESS,(LPARAM)MAKELONG(TRUE,0));
& then is the code for the creation of the Worker Thread:
pApp->pWorkerThread = AfxBeginThread(MaskingFiles_WorkerThread, (void*)pApp->MFC_Obj);
BUT as a result of the above code the Stop button is enabled only after the worker thread has completed. where as i wanted it to be enables before the start of worker thread.
code in the OnUpdateUI for Stop button:
void CMainFrame::OnUpdateToolsStopcurrentprocess(CCmdUI* pCmdUI)
{
CStellarPhoenixApp *pApp = (CStellarPhoenixApp*)AfxGetApp();
if(pApp->bDiskReadProcessStarted)
{
pCmdUI->Enable(TRUE);
}
else
pCmdUI->Enable(FALSE);
}
I donot understand y this is happening.
Waiting for suggestions
dp_76
|
|
|
|