|
sashoalm wrote: Use the HtmlHelp function instead of ShellExecute, it takes care of that.
Please tell me how van i use it i have no idea of that .
if possible please tell me with example.
Thanks in advance.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
const char* help_file_path = "help.chm";
HWND hwnd = AfxGetMainWnd()->GetSafeHwnd();
const char* topic = NULL;
HtmlHelp(hwnd, help_file_path, HH_DISPLAY_TOPIC, (DWORD) topic);
You have to include htmlhelp.h and link with htmlhelp.lib, you'll find them inside the directory of your html workshop, for example "c:\Program Files\HTML Help Workshop"
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
Thanks.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
Hi ,
Basically I work on Lotus Notes, and I am a newbie on Visual C++. As of now, I need to access Lotus Notes Dbs and using Notes C++ API toolkit for Lotus Notes. I have set the environment including PATH , Include and LIB variables. I tried compiling my program (MFC/Dialog). However, its giving me the following compilation errors :
error C2065: 'LNNotesSession' : undeclared identifier
Moreover I have set like this:
#include <lncppapi.h>
龍
|
|
|
|
|
Did you include "LNCPPAPI.H" header?
I found it from here - http://www.taupo.co.uk/examples.html[^]. BTW, Google is your best friend.
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
modified on Thursday, August 14, 2008 5:02 AM
|
|
|
|
|
Hi all, I've written a c++ program that will grab images from camera and will analyze them. it's a kind of some image processing software. but here i want my network users see the result too. one solution is c++ socket programming, I mean i can write a program in c++ that will connect to my image processing server and will get images on the network.
My question is, is it possible for the users to see the results on the internet explorer and not with an additional c++ software? May be a flash module or something that will read stream from server.
Any suggestion?
modified on Thursday, August 14, 2008 1:18 AM
|
|
|
|
|
Hi all,
Can anybody tell me how can i bold the caption of property pages in Property sheet.
The caption is show on tab window of property sheet is a Caption of Property page how can i Bold it.
Please help me for this.
Thanks in advance.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
Hi,
You have to subclass the tab control in CPropertySheet. Use CPropertySheet::GetTabControl API to get the tab control in property sheet. Then override the CTabCtrl::DrawItem .
Please refer here[^] and here also[^]for more information.
Hope this will help you.
Regards,
Paresh.
|
|
|
|
|
Paresh Chitte wrote: Please refer here[^]
It helps to focus selected tab.It changes the color of selected tab.
But please tell me how can i Bold it.It is possible or not.
Thanks.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
Use a bold font!
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I'm using a CFtpConnection to transfer files from my application to a vendor's device. Sometimes, for no apparent reason, the PutFile() pauses (the vendor's device status shows a file transfer in process, but the PutFile() never returns).
Now here's the rub. If I'm in the debugger, and I break the execution, the transfers all work like a champ, and never fail. If I let the code free-run, the freeze occurs.
The "PutFile()" function is called from a separate thread than the CFtpConnection is created in so that I can detect this "hung" condition. The master thread even includes code to try and re-connect to the vendor's device - but the retry only works IF I BREAK execution in the debugger.
The "reconnected" PutFiles always work - always.
If I break the thread prior to creating the CFTPConnection, and then step through the creation, the putfiles always work.
Apparently I'm not initializing something properly in my create FTP connection (or my system in general).
I don't have to deal with WSAStartup and WSACleanup, do I?
Logic looks like this:
{
xferBlock.file_list=createListofFilesToSend( some_location );
xferBlock.pConnect=MakeFTPConnection( sIPAdress, sUser, sPassword, nError );
pThread=AfxBeginThread( AsyncPutFile, this, THREAD_PRIORITY_NORMAL,0, CREATE_SUSPENDED);
pThread->m_bAutoDelete=false;
pThread->ResumeThread();
// loop until done or timed out
do{
UpdateProgressFromxferBlockInfo();
}while( !isTimedOut() && !isDoneAccordingToxferBlock() );
// if timed out...kill progress....
if( isTimedOut() )
KillTheThread( pThread );
}
AsyncPutFile() basically loops through the file_list and does a pConnect->PutFile() on each member.
Not shown are the retry logic, which fails. But if I find out why it's pausing, maybe the retry logic won't fail?
Any ideas?
|
|
|
|
|
I have an MFC ActiveX ControlWizard generated project!
Need to create thread in the project.
I know in a MFC project use ::CreateThread will cause memory leaks! Instead should use ::AfxBeginThread.
But how about _beginthread ?
|
|
|
|
|
If you're planning to use MFC from the thread AfxBeginThread should be used.
Steve
|
|
|
|
|
Do you mean I MUST NOT use _beginthread in a MFC AppWizard(dll) or MFC Activex ControlWizard project, Do I misunstand your meaning?
And there is also an existing MFC OCX project, using too much _beginthread.
Does it occur memory leaks? And MUST I substitute _beginthread to ::AfxBeginThread?
|
|
|
|
|
fantasy1215 wrote: MUST I substitute _beginthread to ::AfxBeginThread?
Only if the thread being created uses MFC classes.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I can't seem to figure out why I am not able to hide/show a group box of Edit controls, I can do it for the edit boxes, but what I wanna do is hide/show the whole group box including its border and text name????? Any ideas?
|
|
|
|
|
Make sure the group box has a unique identifier. You can then use one of the various methods to determine the group box control and show/hide it.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
use
m_gp;//group box variable.
m_gp.ShowWindow(FALSE);//hide
m_gp.ShowWindow(TRUE);//show
same for other variable.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
crap.
that will hide the Group Box control only, not its content...
|
|
|
|
|
toxcct wrote: that will hide the Group Box control only, not its content...
Which is what the OP requested.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
there are several ways for that.
the most robust one is an overload of the GroupBox class which handles the hide/show event and which iterate through every controls of the window and tests if it is within the group box area.
this way, you have nothing more to do than just use an instance of such a class in your window, and call ShowWindow(SW_HIDE) on it for instance.
for performance reasons, I found myself to write my own Group box, which doesn't performs such tests. at the window construction, my version of the GroupBox is waiting for the HWND (or the CWnd) of the controls that are supposed to be within in.
that way, it iterated over that reduced array to send them the hide/show message...
here is my code :
<font color="green"></font>
<font color="blue">#pragma once
#include</font> <MAP>
<font color="blue">class</font> CGroupBoxEx : <font color="blue">public</font> CStatic {
DECLARE_DYNAMIC(CGroupBoxEx)
<font color="blue">protected</font>:
std::map<UINT, BOOL> m_mapChildrenControls; <font color="green">
afx_msg <font color="blue">void</font> OnShowWindow(BOOL bShow, UINT nStatus); <font color="green">
DECLARE_MESSAGE_MAP()
<font color="blue">public</font>:
CGroupBoxEx();
<font color="blue">virtual</font> ~CGroupBoxEx();
BOOL InsertNewChild(CWnd* pwndChild); <font color="green">
BOOL RemoveChild(CWnd* pwndChild); <font color="green">
};
<font color="green"></font>
<font color="blue">#include</font> "stdafx.h"
<font color="blue">#include</font> "GroupBoxEx.h"
IMPLEMENT_DYNAMIC(CGroupBoxEx, CStatic)
CGroupBoxEx::CGroupBoxEx() : CStatic() {
m_mapChildrenControls.clear();
}
CGroupBoxEx::~CGroupBoxEx() {
m_mapChildrenControls.clear();
}
BEGIN_MESSAGE_MAP(CGroupBoxEx, CStatic)
ON_WM_SHOWWINDOW()
END_MESSAGE_MAP()
<font color="green"></font>
BOOL CGroupBoxEx::InsertNewChild(CWnd* pwndChild) {
ASSERT(pwndChild != NULL);
<font color="blue">if</font> (m_mapChildrenControls.find(pwndChild->GetDlgCtrlID()) != m_mapChildrenControls.end()) {
<font color="blue">return</font> FALSE;
}
BOOL bVisible = pwndChild->IsWindowVisible();
m_mapChildrenControls[pwndChild->GetDlgCtrlID()] = bVisible
<font color="blue">if</font> (!this->IsWindowVisible()) {
pwndChild->ShowWindow(SW_HIDE);
}
<font color="blue">return</font> TRUE;
}
<font color="green"></font>
BOOL CGroupBoxEx::RemoveChild(CWnd* pwndChild) {
ASSERT(pwndChild != NULL);
std::map<UINT, BOOL>::iterator iterChild = m_mapChildrenControls.find(pwndChild->GetDlgCtrlID());
<font color="blue">if</font> (iterChild == m_mapChildrenControls.end()) {
<font color="blue">return</font> FALSE;
}
<font color="blue">if</font> ((!this->IsWindowVisible()) && (iterChild->second)) {
pwndChild->ShowWindow(SW_NORMAL);
}
m_mapChildrenControls.erase(iterChild);
<font color="blue">return</font> TRUE;
}
/<font color="green">**
* Event handler of th WM_SHOWWINDOW Windows Message.<BR>
* When the GroupBox is hidden, any child control previously added is hidden.<BR>
* When the GroupBox is unhidden, the children controls are restored to the original
* state they were in before the group were hidden.
*/</font>
<font color="blue">void</font> CGroupBoxEx::OnShowWindow(BOOL bShow, UINT nStatus) {
CStatic::OnShowWindow(bShow, nStatus);
std::map<UINT, BOOL>::iterator iterControls;
CWnd* pwnd = NULL;
<font color="blue">if</font> (!bEnable) {
<font color="blue">for</font> (iterControls = m_mapChildrenControls.begin();
iterControls != m_mapChildrenControls.end();
iterControls++) {
pwnd = this->GetParent()->GetDlgItem(iterControls->first);
ASSERT(pwnd != NULL);
iterControls->second = pwnd->IsWindowVisible();
pwnd->ShowWindow(SW_HIDE);
}
}
<font color="blue">else</font> {
<font color="blue">for</font> (iterControls = m_mapChildrenControls.begin();
iterControls != m_mapChildrenControls.end();
iterControls++) {
<font color="blue">if</font> (iterControls->second.bEnabled) {
pwnd = this->GetParent()->GetDlgItem(iterControls->first);
ASSERT(pwnd != NULL);
pwnd->ShowWindow(SW_NORMAL);
}
}
}
}
modified on Thursday, August 14, 2008 4:53 AM
|
|
|
|
|
Thanks for the replys... I had it coded the same way you guys suggested, but it was crashing originally, but when I recompiled, it seems to work fine.
Thanks again
|
|
|
|
|
Hi !
I have to create a small prototype for a future application that my company wish to develop. A couple of years ago i've learn C++ but for the last 5 years or so i've been programming only in .net (VB, C#) and Java so my knowledge of C++ seems a bit far away So this is why i need your help.
Right now one of the function of our prototype is to "create" a bridge between c++, .net and Java application. One of our supplier send us a Com Dll (C# code) which allow us to interact with their software. Using their myClass.tlb file i've imported the file in the C++ code. This file contain some class.
In one of their class (clCommunication) there is a method call "Get_Message()" and also an Event call "NewMessage". When the Get_Message method is called it trigger the NewMessage Event.
So what i what to know is how to handle the NewMessage event in the c++ code. When the NewMessage will be triggered i want to call a c++ function. I've already done this in .net and in Java but i cannot find the solution in C++.In VB i've done something like:
Function myFunction() Handle aCom.NewMessage. ( When NewMessage will be invoke myFunction will be called)
In C# i have done the same thing using the += operator but in C++ i cannot find out how do to it.
I don't know if this could help but i've noticed that when i create an instance of the class clcommunication there is 3 properties available "add_NewMessage","remove_NewMessage","raw_NewMessage". I guess that i should use them to make what i need but i have no idea where to start.
So let's says that i have a function called "Dothis()" in my c++ code. What did i need to do to automatically triggered this function when a instance of clCommunication will triggered "NewMessage".
Thanks !!!
|
|
|
|
|
I'm using Visual C++ 2008 Professional with a CLR project of Windows Form Application. This program is a stopwatch and I'd like to be able to set a global mouse hook so that when the user clicks anywhere on the screen after pressing a specific button, it will start the timer. How is this possible? I'm not sure what code would be needed to help me, but I will post anything that is needed.
Thanks for your time,
Jordan
|
|
|
|
|
I am just curious as to the best practice for suspending a thread. We have a thread that every once in awhile is required to do something. I am currently using SuspendThread on the CWinThread object. When the thread needs to do work, I Resume the thread. That seems to work well and does not eat up any CPU. But I am just wondering if a better way is to WaitForSingleObject and use an Event to resume the thread.
Using SuspendThread works and is certainly easy to implement, but am just curious which way may provide a better design.
Thanks for the insight.
Note: We were originally ending the thread when it was done with its job, but ran into some other problems. This thread calls into something else which uses OpenMP for multi-threading. When our C++ client thread ended, the OMP threads did not seem to get removed so we kept accumulating OMP threads until we eventually get an error saying too many OMP threads.
|
|
|
|