|
thx! you brought more light into the dark.
I will do - or using _beginthreadex() instead.
|
|
|
|
|
consider file handles..
a file called "test.txt" is opened numerous times which results in different handles allowing access
it's the same with threads. they use dwords instead of strings as identifiers though
use OpenThread(des_access, inherit, threadid) to get the handle of any thread
so bottom line: a handle handles access but is not an id
|
|
|
|
|
Do not pass NULL as lpThreadId , this will cause CreateThread to fail in some Windows OSs. Instead, provide some variable to receive the ID and forget about it you like:
DWORD dwThreadId;
CreateThread(...,&dwThreadId); As for the meaning of this ID, you need it to set/get certain properties of a given thread. I don't know for sure the reason of this duplicity handle/ID (could be IDs are system-wide whereas handles are local to your program.)
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Joaquín M López Muñoz wrote:
could be IDs are system-wide whereas handles are local to your program.
Yes, at least in Win2k there is a process specific handle table that the kernel uses to modify kernel objects. In contrast the ID:s are used to identify the kernel objects themselves (making them system-wide).
I think Win9x uses another approach and is generally slacker on context switches, however.
/moliate
Two o'clock and walking through familiar London - Or what was familiar London before the cursor deleted certain certainties -
I watch a suit and tie man giving suck to the Psion Organizer lodged in his breast pocket
its serial interface like a cool mouth hunting his chest for sustenance, familiar feeling, and I'm watching my breath steam in the air.
Neil Gaiman - Cold Colours
|
|
|
|
|
The HANDLE is processpecific, while the TID is system-wide. If you don't intend to use it, just set it to NULL. As noted above this might not be a good idea for some OS's
/moliate
Two o'clock and walking through familiar London - Or what was familiar London before the cursor deleted certain certainties -
I watch a suit and tie man giving suck to the Psion Organizer lodged in his breast pocket
its serial interface like a cool mouth hunting his chest for sustenance, familiar feeling, and I'm watching my breath steam in the air.
Neil Gaiman - Cold Colours
|
|
|
|
|
I always seem to have the strangest problems with visual studio...
I have been working on a project that up until yesterday compiled and ran fine. Now, the debug version asserts on calls that load a resource, such as a menu or child dialog. In fact the program asserts when just trying to get the handle for the system icon of the main dialog box!
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
The assertion is always in AfxGetResourceHandle() which makes me believe that somehow Visual Studio has lost the "connection" between my user created dialogs, menus, etc. and the code that eventually loads them.
As I said before, nothing has changed in my project except that I have added a couple of new dialogs. I actually had this problem with one of the new dialogs yesterday too, but I was able to remove it from the project and put it back in and it worked fine -- it wasn't too much work since I had just added it. Obviously that isn't an option for the main dialog of my project...
Has anyone had a similar problem, and if so, how did you fix it?
TIA,
--Dean
|
|
|
|
|
Stock Visual response: have you tried doing a clean, full rebuild of everything?
Even if you win the rat race, you're still a rat.
|
|
|
|
|
I tried that but it didn't work. I went so far as to start comparing files such as .rc, .clw, and resource.[fd|h] with backup copies I made a while ago, and I couldn't see any difference other than due to the new resources I have added.
--Dean
|
|
|
|
|
This sounds very similar to a problem I had here when ever I added new resources, in the end I went through the app removing any unused resources that they may have been (you can end up with a few when development spans years / multiple developers... sigh)
I don't know what the details of the problem were, but it probably had something to do with running out of resource space
Dylan Kenneally
London, UK
|
|
|
|
|
I've had issues like that when i went through and manually edited the resource.h file.... to fix it, i just cleaned the project and did a rebuild all. i think devstudio just needs a kick to make it use the new constants.
hopefully this fix'll work for you!
|
|
|
|
|
Hey, Im having some trouble with capturing some events in an Outlook add-in. I was wondering if anyone had, or could give me an example of how to capture and overide an event such as the "open" event.
Right now I have this...
I derive my class from IDispSimpleEventImpl...
class ATL_NO_VTABLE CDaFun :
public IDispEventSimpleImpl<1,CDaFun,&__uuidof(Outlook::ItemEvents)>
typedef IDispEventSimpleImpl<1, CDaFun, &__uuidof(Outlook::ItemEvents)> ItmEvents;
Then setup a callback...
void __stdcall OnOpenItem(IDispatch* Ctrl, VARIANT_BOOL * CancelDefault);
and then the sinkmap...
SINK_ENTRY_EX(1,__uuidof(Outlook::ItemEvents),0xf003,OnOpenItem)
Now Advising im not sure about. Try to get a pointer to the interface i need. Im not sure if Inspectors is right...
CComQIPtr spApp(Application);
CComQIPtr spInsp;
spInsp = spApp->Inspectors;
ItmEvents::DispEventAdvise((IDispatch*)spInsp,&__uuido(Outlook::ItemEvents));
The advise fails, so im not how to set that up right. Please help
THanks
|
|
|
|
|
I simply can't remember it.
THanks in advance.
|
|
|
|
|
see GetDeviceCaps. you can get resolution, DPI, etc..
-c
Garbage collection, making life better - for weenies!
|
|
|
|
|
::GetSystemMetrics(SM_CXSCREEN);
::GetSystemMetrics(SM_CYSCREEN); or
::GetDeviceCaps(::GetDC(NULL), HORZRES);
GetDeviceCaps(::GetDC(NULL), VERTRES);
|
|
|
|
|
I'm not sure, but shouldn't you be using ReleaseDC on the screen dc returned by GetDC(NULL) ?
Cheers, Marc Click to see my *real* signature
|
|
|
|
|
I need to restrict the resizing of the SDI application.
I tried the method found in
http://www.codeproject.com/useritems/mdibackgroundimage.asp
to hook on to WM_SIZING and it worked.
But i was wondering whether there was any other way, any msg i could overload?
tried all the PreTranslateMessage and ProcessMessageFilter message map, but it did'nt work.
This is a slightly modified one from winamp plugin.
very slightly. i just wanted
WNDPROC pfnOldWndProc;
LRESULT CALLBACK pfnNewWndProc(HWND hwnd, UINT uMsg, WPARAM wParam,LPARAM lParam)
{
CRect rect;
switch (uMsg) {
case WM_SIZING :
if ((wParam==WMSZ_BOTTOMLEFT) || (wParam==WMSZ_BOTTOMRIGHT))
wParam=WMSZ_BOTTOM;
else if ((wParam==WMSZ_TOPLEFT) || (wParam==WMSZ_TOPRIGHT))
wParam=WMSZ_TOP;
GetWindowRect(hwnd,rect);
((RECT*)lParam)->left= rect.left;
((RECT*)lParam)->right = rect.right;
break;
}
return CallWindowProc(pfnOldWndProc, hwnd, uMsg, wParam, lParam);
}
and in InitInstance()
HWND hMain = GetActiveWindow();
pfnOldWndProc = (WNDPROC)GetWindowLong(hMain, GWL_WNDPROC);
SetWindowLong(hMain, GWL_WNDPROC, (long)pfnNewWndProc);
|
|
|
|
|
aldeba wrote:
I need to restrict the resizing of the SDI application.
WM_MINMAXINFO is what you need
Christian
I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002
Half the reason people switch away from VB is to find out what actually goes on.. and then like me they find out that they weren't quite as good as they thought - they've been nannied. - Alex, 13 June 2002
|
|
|
|
|
Ur Requirement is to limit resizing.
U should go for the message WM_GETMINMAXINFO.
OnGetMinMaxInfo(MINMAXINFO *mmi) message handler, mmi->ptMaxSize, mmi->ptMaxTrackSize, mmi->ptMaxTrackSize are the relevent member to be filled to limit resizing.
mmi->ptMaxTrackSize is SIZE u want to restrict.
|
|
|
|
|
Hi,
I have application thread ID with me. How can I find out the Application main window handle from it ? I have a c# toolbar as a window inserted in the application sharing same thread ID. What should I do?
VIKS
|
|
|
|
|
Hi,
I have application thread ID with me. How can I find out the Application main window handle from it ? I have a c# toolbar as a window inserted in the application sharing same thread ID. What should I do?
VIKS
|
|
|
|
|
Hi ,
I just want some technical document stating how VC++ treats JPEG images.
Thanks
Sutanu
Sutanu Lahiri
Software Engineer
Calcutta, India .
|
|
|
|
|
VC++ doesn't care about JPGs. GDI+ does, and there are many classes on this site that do.
-c
Garbage collection, making life better - for weenies!
|
|
|
|
|
I want to use ActiveMovie (ocx) to play mp3 in my program.
I use it as follow:
// CFileDialog dlg(TRUE,"mp3",NULL,OFN_HIDEREADONLY,NULL,NULL);
if(dlg.DoModal ()==IDOK)
{
CString pathname=dlg.GetPathNmae();
m_MusicPlayer.SetAutoStart (TRUE);
m_MusicPlayer.SetFileName( pathname);
}
But every time I open the mp3,the program will exit auotmatically.
I trace the program and found that when the program run to
m_MusicPlayer.SetFileName( pathname);
the program will quit.
I don't what cause this.
And I use Windows Media Play 8!
Thank you for help!
Don't look at me in that way!
|
|
|
|
|
Hi.
There are some applications (not only from Microsoft), which allow users to write and execute macros in Visual Basic. I would like to include feature like this in my program written in Visual C++. How to do this? (any source code examples?, URL's to documentation?)
Greets,
Juntek
|
|
|
|
|
Check out the MSDN documentation for IActiveScript . This is how most apps do it I believe. It requires that you make all your 'scriptable' objects into COM objects. IActiveScript supports JavaScript and VBScript among others (actually it supports whatever script engine you have installed)
Also check out IActiveScriptParse, which is the easiest place to start.
|
|
|
|