|
By registering, I meant using regsvr32.exe. I've not tried this via code.
|
|
|
|
|
The custom control is implementet in the application and not in a dll or something else.
I can use it the same way I tried it in ma Application in other sample programs without problems.
|
|
|
|
|
Iam new to programming in .NET's C++ and I am a little puzzeled on how to perform the following
Objective: I need to have a main PC communicate with to other PC's. The information I need from the additional PC's is what is currently running(i.e. windows programs, etc.) and send a message back. After that I need to have the main PC shutdown or shutdown/reboot the additional PC's and or the main PC
I know I know how to perform the Shutdown or shutdown/reboot.
How do I communicate with the other PC's to tell me what is running on them?
Is there anything that I can research which will help me?
Thank you for your help
|
|
|
|
|
You might use the windows performance monitor api. If you have used the windows performance monitor, you know that you can look at a report of what processes are running. Look at WMI.
Alternatively, rather than query for all that info and make a remote decision, why not signal a check on the computer to be shut down? You would write a service that would run on the shutdown-able PCs. There are multiple ways to signal the remote service, however since you probably are interested in signalling all such PCs, a mailslot (using a * for the coputer name) may be the easiest approach.
Obviously, I'm not providing details here, but direction for further research on your part.
tim
tim
Founder, TMurgent Technologies
www.tmurgent.com
tmangan@tmurgent.com
|
|
|
|
|
Hi,
I have a dialog who will contains other dialogs accessible by a CTabCtrl control.
When I click the tabs, I change the dialogs to display.
I want to display the dialogs in the tab control, under the tabs.
To do this I have to get the dimensions of the rectangle corresponding to the CTabCtrl itself minus the height of the tabs.
The problem is that I am not able to get the good position of the tab control.
I have to modify the position with number freeze in the code. I am not sure that it will be correct for all monitors.
The code is taken from the article "Creating a CTabCtrl Application" in CodeGuru.
Here is my code:
void CPref_04::SetRectangle()
{
CRect tabRect, itemRect;
int nX, nY, nXc, nYc;
m_TabPref.GetItemRect(0, &itemRect);
// uses GetDlgItem to return a pointer to a user interface control
CTabCtrl* pTab;
pTab = (CTabCtrl*) GetDlgItem(IDC_TAB_PREF);
pTab->GetClientRect(&tabRect);
nX = itemRect.left + 10; <----- number freeze in the code
nY = itemRect.bottom + 12;
nXc = tabRect.right - itemRect.left;
nYc = tabRect.bottom - nY + 10;
m_tabPages[0]->SetWindowPos(&wndTop, nX, nY, nXc, nYc, SWP_SHOWWINDOW);
for (int nCount = 1; nCount < m_nNumberOfPages; nCount++)
{
m_tabPages[nCount]->SetWindowPos(&wndTop, nX, nY, nXc, nYc, SWP_HIDEWINDOW);
}
}
Thanks for any help
Claude
|
|
|
|
|
Try getting the window rect and use ScreenToClient() if applicable.
Kuphryn
|
|
|
|
|
RECT r;
tabCtrl.GetWindowRect(&r);
tabCtrl.AdjustRect(FALSE, &r);
tabCtrl.ScreenToClient(&r);
or somethign along the lines... (I could dig up a project and look it up if this doesn't work as intended)
"Der Geist des Kriegers ist erwacht / Ich hab die Macht" StS
sighist | Agile Programming | doxygen
|
|
|
|
|
Hi Claude,
I use this code to activate a page:
int
CDlgTabCtrl::SetActivePage( int iPage )
{
//Place the window top-left under the tab-control
CRect rect;
GetClientRect( &rect );
AdjustRect( FALSE, rect );
CRect rectTab;
GetWindowRect( &rectTab );
GetParent()->ScreenToClient( rectTab );
rect.top +=rectTab.top;
rect.left +=rectTab.left;
//verify parameters
if( iPage+1 > m_iPages )
{
iPage =0;
}
if( iPage < 0 )
{
iPage =m_iPages-1;
}
// get the actual page
CDlgTabPage* pPage;
pPage =(CDlgTabPage *)m_Pages.GetAt( m_iActivePage );
// deactivate it
pPage->ShowWindow( SW_HIDE );
HighlightItem( m_iActivePage, FALSE );
// get the new page
pPage =(CDlgTabPage *)m_Pages.GetAt( iPage );
//adjust the position and show it
pPage->SetWindowPos( NULL, rect.left, rect.top, 0, 0, SWP_SHOWWINDOW | SWP_NOSIZE );
pPage->m_pTabCtrl =this;
pPage->OnSetActive();
m_iActivePage =iPage;
HighlightItem( m_iActivePage, TRUE );
// set the CTabCtrl-element
SetCurSel( m_iActivePage );
SetFocus();
//OkeeDokee
return m_iActivePage;
}
Make sure to set the DS_CONTROL style to your dialog pages, makes life a lot easier...
dirk
|
|
|
|
|
I have wrote a simple keyframe grabber using the directX api that grabs a frame on time intervals,
Would any one know of a library or a way to determine when to grab a frame based on scene change? Any help or guide would really be a life saver!!
|
|
|
|
|
google for source code to video survaillence / webcam alarm systems etc or possibly look at delta error type stuff from a mpeg codec
|
|
|
|
|
Does anyone have any idea why VC 2003 .NET will not allow me to create a control variable for ComboBox in a secondary dialog (created using Add Resource) and activated using the DoModal function.
If I put the ComboBox in the main Dialog, I can create a control variable. I can create a control variable for it even if I put it in the ABOUT dialog. But for some reason, it simply doesn't like assigning a control variable to a ComboBox that is in a dialog that was created with the Add Resource function.
Anyone got any ideas?
Karen
|
|
|
|
|
Maybe the developer studio that you have has a bug. One solution is to add the control manually.
Kuphryn
|
|
|
|
|
How to copy and paste text in a cell in excell.
funtion _Application::GetSelection return what?
Help me please
|
|
|
|
|
Here's an example of how to set the value of an Excel cell:
if (app.CreateDispatch("Excel.Application") == TRUE)
{
app.SetVisible(TRUE);
books = app.GetWorkbooks();
book = books.Add(vtOptional);
sheets = book.GetSheets();
sheet = sheets.GetItem(COleVariant((short) 1));
range = sheet.GetRange(COleVariant("A1"), COleVariant("A1"));
range.SetValue(COleVariant(strText));
...
}
You should be able to ascertain from this how to get the value of a cell.
|
|
|
|
|
Thanks Mr David!
Yes, I know this. But May you help me how to copy text to clipboard?
In Word I do this:
_Application app;<br />
Range range;<br />
.....<br />
range.Select();<br />
Selection sel=app.GetSelection();<br />
sel.Copy<br />
sel.Paste <br />
<br />
In excel I see funtion app.GetSelection. But I don't know what object that is returned.
please help me.
Thanks
Jason Chang
tmsnhien@yahoo.com
|
|
|
|
|
I have a TCP server that uses two classes: a ConnectionManager and a DbgConsole. U can specify a parameter in console to turn on logging. It just outputs all its output through DbgConsole with a function called ConsoleOutput() which just couts a string to the console and if logging is enabled writes the string to a file. When logging is turned on, the DbgConsole class opens a new file and stores the file handle in a private member variable of that class. From then on the ConsoleOutput function just uses that handle to write to the file and log every line. This works great UNTILL...
I have a function AddConnection in the ConnectionManager class like this:
<pre>
void ConnectionManager::AddConnection(SOCKET _sd)
{
ClientConnection *cc = new ClientConnection;
cc->s = _sd;
cl.push_back(cc);
PrintClientList();
}
</pre>
This just adds the socket in a struct to the list, this is the PrintClientList() function:
<pre>
void ConnectionManager::PrintClientList()
{
cout << "Client list(by socket handle):" << endl;
CLI cli;
for ( cli = cl.begin(); cli != cl.end(); ++ cli )
{
cout << (*cli)->s << endl;
}
return;
}
</pre>
So whenever i add a connection it adds it to the list and prints the list of socket handles out to the console. This works fine untill logging is turned on. If i leave out the printing of the list (so PrintClientList()) then it works fine, but if i include it my app crashes, even though it prints it fine if logging is disabled.. I can't figure out what the problem is.. Does anyone have any ideas?
Kuniva
--------------------------------------------
|
|
|
|
|
Why toolbar created by following code do not creates tool-tips?
I checked that string resiurce is presented ith button identifier,
and property of promt if button is set to this string.
<br />
<br />
if (!m_wndToolBar.CreateEx(this,<br />
TBSTYLE_FLAT,<br />
WS_CHILD | WS_VISIBLE | CBRS_TOP<br />
| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC <br />
)<br />
|| !m_wndToolBar.LoadToolBar(IDR_MAINFRAME/))<br />
<br />
<br />
thanks you
|
|
|
|
|
Hi,
Sorry for the very basic question - I am a beginner so please excuse me:
Could someone please tell me where I can find info on using a rich edit box in a dialog-based application without using any MFC? I mistakenly thought that it would be as simple as using any other control, but it seems not. All I want to do is have a white box with a lot of text in it and a scrollbar to scroll through it (user can't input anything). I guess a rich edit box is what I need. But I tried to add a rich edit box to my dialog and then set its text using SetDlgItemText, and if I compile and run, the dialog just exits without showing _anything_, as though the program hasn't run at all. It seems this has nothing to do with my code (well, it probably has something to do with what I'm _not_ doing in my code), as even if I took any code out relating to the rich edit box, so long as it was in my dialog, if I run, it exits as though nothing has happened. I read on MSDN that you need to call AfxInitRichEdit(), but when I tried this I just got an "undeclared identifier" message, so I guess this is just for MFC...
Any pointers would be really appreciated. Sorry again if this is a dumb question.
Many thanks,
KB
|
|
|
|
|
Have you loaded the riched32.dll (for RichEdit 1.0) or riched20.dll (for RichEdit 2.0) library? This is all that AfxInitRichEdit() does
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Thanks, that solves my problem perfectly - you've given me quite a few useful replies over the past week or so, I really appreciate it, thanks again.
Cheers,
KB
|
|
|
|
|
You're welcome
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
I have an application which I would like to change the behavior of the save button in a modal dialog box. Since I do not have the source code I was hoping that maybe this Window's hook may work.
I would like to make the following changes with the save button:
1) Once save button is pressed
2) Hook the button in order to run another application which will
3) Require operator login
4) Then save the file
I have been doing alot of searching on Windows Hooking Techniques but unfortunatly most of the examples that I find are hooking the mouse or keyboard. I have not been able to find anything useful with regards to the WH_SYSMSGFILTER & WH_MSGFILTER. Does anyone have any experience with these hooks. Any examples etc. which would be helpful in getting me started down the right track would be greatfully appreciated!
Thanks In Advance!!!
Bob Younger
|
|
|
|
|
yes, me too..
I have to map enum values to a string, and back. The string is a custom string (but a "complete" solution using the name of the enum constant would be ok, too)
anybody having nicely wrapped-up solution for it?
I need two-way lookup, case insensitive...
"Der Geist des Kriegers ist erwacht / Ich hab die Macht" StS
sighist | Agile Programming | doxygen
|
|
|
|
|
There are not elegant solutions for two-way lookup using STL map. How big does the contain get? If it is relatively small, one solution is to simply use two maps.
Kuphryn
|
|
|
|
|
I'm trying to figure out what I'd need.
The lookup is ok with a single map - searching for the value linearly is fast enough. For the case-insensitive string comparison I'd use the map lookup of course
I wonder about the other stuff - keeping "enum miantenance" as low as possible.
"Der Geist des Kriegers ist erwacht / Ich hab die Macht" StS
sighist | Agile Programming | doxygen
|
|
|
|