|
First, thank you for your help so far.
Here's some more information about my problem:
I want to fill a list (box) with processes (represented through window titles) to terminate. To perform this task I'm using EnumWindows(). In the EnumWindowsProc I filter out invisible windows, windows without a title, certain window classes (tooltips etc.) and windows that don't return NULL for GetWindow(hWnd, GW_OWNER)...
This works fine if there's only one (top-level) window-owning thread per process. Otherwise more than one window per process passes my EnumWindowsProc. To avoid this I want to filter out all windows created by secondary threads...
Does anybody here know a solution?
|
|
|
|
|
Hi
I just wrote a function that hides multiple or a single window(s).
It looks like this:
void HideWindows(HWND wnds)
{...}
but it should work with HWND-arrays ( HWND wnds[20]) same as with a single variable (HWND window).
how can I accomplish this?
thanks in advance
|
|
|
|
|
void HideWindows (HWND *pwnds, int nCount)
{
}
If this is C++, you can add the helper function.
void HideWindows (HWND hWnd)
{
HideWindows (&hWnd, 1);
}
Tim Smith
Descartes Systems Sciences, Inc.
|
|
|
|
|
I can show you what the function does in fact:
void TaskbarOp(BOOL Add, BOOL Multiple, const int IfMultipleThenCount, const HWND *pWindows)
{
CoInitialize(NULL);
ITaskbarList *pDisp = NULL;
CoCreateInstance( CLSID_TaskbarList, NULL, CLSCTX_SERVER, IID_ITaskbarList, (LPVOID *) &pDisp );
if(Multiple)
{
for(int i = 0; i < IfMultipleThenCount; i++)
{
if(Add)
pDisp->AddTab( pWindows[i] );
else
pDisp->DeleteTab( pWindows[i] );
}
}
else
{
if(Add)
pDisp->AddTab( pWindows );
else
pDisp->DeleteTab( pWindows );
}
pDisp->Release();
CoUninitialize();
}
is there something I should change? There are some error at
else
{
if(Add)
pDisp->AddTab( pWindows );
else
pDisp->DeleteTab( pWindows );
}
|
|
|
|
|
The diference is that you are passing pWindows.
pWindows is a pointer to HWND and pWindows[i] is a HWND.
Best Regards
Carlos Antollini.
|
|
|
|
|
What should I pass then instead of pWindows?
|
|
|
|
|
You are WAY over designing your routine. How about something like this.
void TaskbarOp(BOOL Add, const int nCount, const HWND *pWindows)
{
ITaskbarList *pDisp = NULL;
CoCreateInstance( CLSID_TaskbarList, NULL, CLSCTX_SERVER, IID_ITaskbarList, (LPVOID *) &pDisp );
for(int i = 0; i < IfMultipleThenCount; i++)
{
if(Add)
pDisp->AddTab( pWindows[i] );
else
pDisp->DeleteTab( pWindows[i] );
}
pDisp->Release();
}
void TaskbarOp(BOOL Add, HWND hWnd)
{
TaskbarOp(Add, 1, &hWnd);
}
Also, don't call CoInitialize/CoUninitialize like that unless you really really have to. Just call CoInitialize at program start and CoUninitialize at the end.
Tim Smith
Descartes Systems Sciences, Inc.
|
|
|
|
|
You are ingenious
Thanks a lot! ![Rose | [Rose]](https://codeproject.freetls.fastly.net/script/Forums/Images/rose.gif)
|
|
|
|
|
I'm writing a program in API (not MFC) and my current dillemma is destroying windows. I know DestroyWindow() destroys it, but then it processes WM_DESTROY and a PostQuitMessage(0) and the whole program exits. I just want to hide or quit the window without the whole program running. If I don't use PostQuitMessage(0), the window disappears but it still exists in the background and runs in the task manager though no windows are apparent, and I dont want that. Whats a good command or way to close or hide a window without quitting the program? Thanks - Dave
|
|
|
|
|
What About ShowWindow(SW_HIDE);?
best Regards
Carlos Antollini.
|
|
|
|
|
You can post a WM_CLOSE to that window.
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
Nish is a BIG fan of Goran Ivanisevic
|
|
|
|
|
Hello I'm wondering if anyone can help me with the following:
If using RegSetValueEx, to set up a value which holds as hexidecimal this value: 0x00000019(25)-this is how it's supposed to be shown in the regedit. Since it's a dword value i have declared DWORD dw = 19; but it doesen't write it as 0x00000019 (25). When I use the regedit to add it manually it works perfect - I put 25 as decimal and when i change it to hex it's 0x00000019; Any example of doing that programatically?
Thanks,
Deian
PS: Please include everything, declaration of variables, initialization and everything needed ![Blush | :O](https://codeproject.freetls.fastly.net/script/Forums/Images/smiley_redface.gif)
|
|
|
|
|
DWORD dwValue = 25;
::RegSetValueEx(m_hKey, (LPCSTR)lpValueName, 0, REG_DWORD, (LPBYTE)&dwValue, sizeof(DWORD))
Best Regards...
Today Is Friday!!! Party and
Carlos Antollini.
|
|
|
|
|
Is there a way to change the color of the scroll bar in a list control?
Rob
|
|
|
|
|
I would disable Help button on the "Customize Toolbar" dialog box
but I wan't use the caption of the control for a code independent of the language.
Thank you for your collaboration. ![Smile | :)](https://codeproject.freetls.fastly.net/script/Forums/Images/smiley_smile.gif)
|
|
|
|
|
Why Insert and Delete is not working?
char *convert_char_modifier(char *Modifier)
{
int i;
char ch;
for (i=0; i < strlen(Modifier);i++)
{
ch = Modifier[i];
switch (ch)
{
case 'A':
//Delete(i);
//Insert(i,"01");
break;
sardinka
|
|
|
|
|
Apart from the fact they are commented out?
I think we'll need to see the code for Delete and Insert too.
Michael ![Smile | :)](https://codeproject.freetls.fastly.net/script/Forums/Images/smiley_smile.gif)
|
|
|
|
|
I comment that line out, but even if I uncomment that line it will not work.
My code is below:
char *convert_char_modifier(char *Modifier)
{ int i;
char ch;
for (i=0; i < strlen(Modifier);i++)
{
ch = Modifier[i];
switch (ch)
{
case 'A':
Insert(i,"01");
break;
case 'B':
Delete(i);
Insert(i,"02");
break; }
}
return(Modifier);
![Cry | :((](https://codeproject.freetls.fastly.net/script/Forums/Images/smiley_cry.gif)
|
|
|
|
|
Did you see the code I posted to your earlier question? The reply wasn't actually to you, but to someone else who had replied to your original message.
Check it out.
By the way, it looks like you're trying to mix CString methods with a simple char array.
beyond that, what happens for lower case alpha characters, or characters that aren't letters at all? You have no code to handle those possibilities.
Is this a homework assignment?
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Gosh, you're doing it the hard way, aren't you ? Like John said, check out the code he posted in reply to my comment ( which was essentially to do what John has shown you, build a second string ).
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
|
|
|
|
|
This is a solution in plain C. If this is a homework, you should really make sure that you understand the code, and then rewrite it from memory. You will not learn anything otherwise. Also note that more memory than needed may be allocated (what can you do about that?).
After seeing some horrible previous posts (think calculator ) I had to answer this one to show that a *little* politeless could get you far...
/moliate
starting to sound 50 year older now, better quit...
char* convert_char_modifier(char *Modifier)
{char* tmp = new char[strlen(Modifier)*2];
char* Result = tmp;
for (;*Modifier; Modifier++)
{if (*Modifier >='A' && *Modifier <= 'Z')
{*tmp++ = char((*Modifier - 'A')/10+'0');
*tmp++ = char((*Modifier - 'A')%10+'1');
}
else
*tmp++ = *Modifier;
}
*tmp = '\0';
return Result;
}
int main(int argc, char* argv[])
{ char* Modifier = "A79867B987C98ZZ";
printf("%s\n", convert_char_modifier(Modifier) );
return 0;
}
|
|
|
|
|
Hi,
I need a canvas for drawing with some basic shapes ( just one rectangle, one circle, and connection lines ( smart connection lines...). I wouldn´t like to reinvent the wheel...
Do you know if there is some library, dll, or whatever to do that already done, ( free or paying), I think I saw sometime ago a company that sell that but now I cannot find it...
Thanks, Bye !
Braulio
|
|
|
|
|
I know of a few.
Dundas has Ultimate Diagram. It is not on their web site due to it no longer being supported but it is still available.
Also Bennet-Tec has a package called metadraw. It seams to be directed at the VB market.
I know there was at least one more but my memory fails right now.
Michael A. Barnhart - mabtech@swbell.net
Sorry for the anonymous - I have not been able to login since last week. I hope Chris get back and can look into what is happening.
|
|
|
|
|
Hi there,
I'm a beginner of VC++, I would like to use CFileDialog to read in the name of the file that I need to open, and pass this variable to fileDoc.cpp to open the file, but I always encounter error. Could you pls help me!
MainFrame.h
class CMainFrame : public CFrameWnd
{
protected: // create from serialization only
CMainFrame();
DECLARE_DYNCREATE(CMainFrame)
// Attributes
public:
CFileDoc* GetDocument();
// Operations
........
}
MainFrm.cpp
void CMainFrame::OnEditImport()
{
// TODO: Add your command handler code here
d_pOpenFile = new CFileDialog (TRUE);
iRet = d_pOpenFile->DoModal();
CFileDoc* pDoc = GetDocument();
pDoc->m_strName = d_pOpenFile->GetPathName();
pDoc->FindMax();
}
fileDoc.cpp
void CFileDoc::FindMax()
{
ClearBuf();
if((stream = fopen(m_strName,"r")) != NULL)
{
for(row =0; row <= 2000; row++)
........
}
Error Msg
c:\vcpp32\integration2\mainfrm.h(22) : error C2143: syntax error : missing ';' before '*'
c:\vcpp32\integration2\mainfrm.h(22) : error C2501: 'CFileDoc' : missing storage-class or type specifiers
c:\vcpp32\integration2\mainfrm.h(22) : error C2501: 'GetDocument' : missing storage-class or type specifiers
MainFrm.cpp
Generating Code...
Error executing cl.exe.
Can someone tell me wants wrong with my code?
Thank you!![Confused | :confused:](https://codeproject.freetls.fastly.net/script/Forums/Images/smiley_confused.gif)
|
|
|
|
|
You cannot declare an instance of an object before you have defined it. You must include the header for the definition of CFileDoc in the compilation path exposed to CMainFrame. For example,
"#include filedoc.h"
at the beginning of mainframe.cpp.
"But, daddy, that was back in the hippie ages..." My twelve year old son - winning the argument.
"Stan, you are an intelligent guy who responds in meaningful ways" Paul Watson 16/10/01
|
|
|
|