|
Hi,
In my SDK application i want to add a set a strings to a ListBox . I'm searching for a set of files from a directory and i want to add those files to the list box. How can i solve it.
vini
|
|
|
|
|
Check out LB_ADDSTRING and LB_INSERTSTRING
--Mike--
My really out-of-date homepage
"Why does anyone have a web page? Too much free time... not enough friends... justifying owning a computer." -- Noel Crane on Felicity
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan.
|
|
|
|
|
I don't know how to go to the URL from the program.
As I am the Beginner, I knew basic syntax of C++. However, I do not have the concept of internet programming.
My question is:
When I write the C++ program based on MFC, I want to click the button so that the browser will open automatically and go to the specific URL. I think it is not difficult but I spent much time on it. (This is such like the function "help" of most software program. When the user clicks on the "help" button, the browser is opened and go to the URL) Can anyone help?
Thank you.
Dicky
|
|
|
|
|
Use ShellExecute to run the default browser:
ShellExecute ( hwndYourWindow, "open", "http://xxx.yyy.com/help.html", NULL, NULL, SW_SHOW );
--Mike--
My really out-of-date homepage
"Why does anyone have a web page? Too much free time... not enough friends... justifying owning a computer." -- Noel Crane on Felicity
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan.
|
|
|
|
|
I've designed the interface to my application in the following manner:
To the left of the application main window are 5 buttons, placed vertically (Button1,Button2 etc). Each button have an associated property sheet.On clicking each button ,it should open its corresponding property sheet within the right hand side of the application window.But the following code displays the property sheet in a new window.
// OnClickButton1 function
// a property sheet is created with two tabbed controls tab1 and tab2
PropertySheet prop1("Option1");
CTab1 Tab1; // CTab1 is derived from PropertyPage
CTab2 Tab2; // CTab2 is derived from PropertyPage
prop1.AddPage(&Tab1);
prop1.AddPage(&Tab2);
prop1.DoModal();
How can i modify the code in such a way that the property sheet opens within the right side of the main window rather than in a new window? ie,the main window should contain the property sheet or the property sheet should not have the titlebar..please help me..
anish
|
|
|
|
|
|
What do you mean by that?
All processes will have their own current directory.
If you mean the shell, then the default directory is the desktop [not 100% sure abt this though]
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
I have encountered this error
layer.obj : error LNK2005: "public: __thiscall input_layer::input_layer(int,int)" (??0input_layer@@QAE@HH@Z) already defined in back_prp.obj
fatal error LNK1169:one or more multiply defined symbols found
solution for this one is required urgently.
And also can't we declare 2 .CPP files in one project??
Thanks in advance
anila
Student
Masters of Computer Sciences
knowledge seeker
|
|
|
|
|
I'm a little puzzled about the error message but it appears as if you've defined the same variable in those two files.
1. Rebuild the whole project.
2. If that doesn't fix it, take a look at this related explanation I wrote about a while back.
Regards,
Alvaro
|
|
|
|
|
Part of the project that I'm working on is placing text over the child window. The user must be able to set font, resize and move text "object" inside the child window client area at any time.
I succeeded in creating transparent window with some text drawn inside, but window repainting is absolutely unpredictable and it is effecting the whole application.
Any suggestions/ideas on this subject?
Thanks in advance
|
|
|
|
|
Transparent windows are not actually transparent, they just don't redraw properly. They are, as you say, unpredictable.
I did this in a paint type package, and I just kept a vector ( an array ) of structures that told me what string to draw, in what font, and the bounding rect to all me to select items when they were clicked on.
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
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
Maybe the simple way is better: draw text in child the window itself using TRANSPARENT background mode?
|
|
|
|
|
Christian and Alex, thanks for your input.
|
|
|
|
|
I hope this is an easy one....
How do I get the time between clicks that counts as a double-click?
I can find the allowed difference via GetSystemMetrics(...) but I can't find the time. I hate hard coding this type of thing.....
|
|
|
|
|
It doesn't happen often but Microsoft actually came up with a function with a good name for this: GetDoubleClickTime.
Regards,
Alvaro
|
|
|
|
|
Thanks. That was too easy!!!! Can you tell it's Friday?
|
|
|
|
|
Hi,
Is there any sample for resolving folder shortcut to a network path. Or to a app (full path name)? It has to be supported on NT/2000/XP. I'm aware of IShellLink.
Thanks
|
|
|
|
|
i can use the API "EnumProcess" for get all identifiers for each process object in the system. but how do i can get the full path for the particularly process?
thanks for your help!!!!!!!!!!
My english is poor, please pardon.
|
|
|
|
|
|
thanks! i can do it, now
My english is poor, please pardon.
|
|
|
|
|
Hi,
When you sort columns in Windows explorer on win XP, it highlights the column being sorted. Any idea about “how to” for this?
Thanks
|
|
|
|
|
Maybe that's a built-in feature of the v6 common controls? But if not, you can do it yourself with custom draw.
--Mike--
My really out-of-date homepage
"Why does anyone have a web page? Too much free time... not enough friends... justifying owning a computer." -- Noel Crane on Felicity
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan.
|
|
|
|
|
It is not built in feature of commctrl 6. any other options beside custom draw?
|
|
|
|
|
Custom draw is perfect for customized drawing like that. The alertnative is owner draw, which is overkill for what you want to do.
--Mike--
My really out-of-date homepage
"Why does anyone have a web page? Too much free time... not enough friends... justifying owning a computer." -- Noel Crane on Felicity
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan.
|
|
|
|
|
I am using this component to retrieve disconnected recordsets to an ASP or VB client. I pass in a SQL Statement and return the disconnected Recordset.
Under COM+ Component Services, I created and application and set the following properties: Object Pooling, IObjectConstruction, JITA, Transactions are set to NOT Supported. I do not plan on using transactions in my project.
The Example I followed (Alan Gordon's) to build this DID NOT include the IObjectControl Interface.
I added, you can see that its references are commented out. (The component runs fine with and w/o the IObjectControl declares.
The component appears to function properly. Of course it has not really been stress tested.
My question to you is??? Is this properly coded?? I read in Tim Ewald's Transactional COM+, that you must use IObjectControl if you are using ObjectPooling and JITA.
Is this true? Could you take a quick look over this and give me your opinion? How would you code this differently to ensure that IObjectControl is being used properly with ObjectPooling and JITA. If you need to see the whole project, I can send it to you zipped.
Happy Holidays !!
Sincerely,
Peter J. Santiago
www.whiteknightinc.com
// Book.cpp : Implementation of CBook
#include "stdafx.h"
#include "Articleproject.h"
#include "Book.h"
const E_CONFIGURATION=MAKE_HRESULT(SEVERITY_ERROR,FACILITY_ITF,0x200+108);
const E_CONFLICTS_FOUND=MAKE_HRESULT(SEVERITY_ERROR,FACILITY_ITF,0x200+109);
const int conTitleFieldLength=80;
#undef EOF
/////////////////////////////////////////////////////////////////////////////
// CBook
//HRESULT CBook::Activate()
//{
// HRESULT hr = GetObjectContext(&m_spObjectContext);
// if (SUCCEEDED(hr))
// return S_OK;
//return hr;
//}
//BOOL CBook::CanBePooled()
//{
// return TRUE;
//}
//void CBook::Deactivate()
//{
// m_spObjectContext.Release();
//}
STDMETHODIMP CBook::InterfaceSupportsErrorInfo(REFIID riid)
{
static const IID* arr[] =
{
&IID_IBook
};
for (int i=0; i < sizeof(arr) / sizeof(arr[0]); i++)
{
if (::ATL::InlineIsEqualGUID(*arr[i],riid)) // pjs added
return S_OK;
}
return S_FALSE;
}
STDMETHODIMP CBook::RetrieveByID(BSTR id, _Recordset **rs)
{
_bstr_t strDescription;
HRESULT hRetval;
_ConnectionPtr pConn;
_RecordsetPtr pRS;
IContextState *pContextState=NULL;
if (0==mConnectionString.length())
{
hRetval=E_CONFIGURATION;
strDescription=L"You must configure a connection string";
goto exit_cleanup;
}
hRetval=CoGetObjectContext(IID_IContextState,(void **)&pContextState);
if (SUCCEEDED(hRetval))
{
// NEW WAY PJS 12/8/2001 TO PASS IN SQL STMT AND CREATE AN DISCONN RECORDSET
_bstr_t sql(id);
try
{
// Create and Open the Connection PJS
pConn.CreateInstance( __uuidof(Connection));
pConn->Open(mConnectionString, "", "",-1);
// Create and Open the Recordset PJS
pRS.CreateInstance( __uuidof(Recordset));
pRS->CursorLocation=adUseClient;
pRS->Open(sql,pConn.GetInterfacePtr(),adOpenStatic,adLockBatchOptimistic,-1);
pRS->AddRef();
*rs=pRS;
pRS->PutRefActiveConnection(NULL);
}
catch ( _com_error err)
{
strDescription=err.Description();
// PJS
hRetval=err.Error();
}
}
else
{
_com_error err(hRetval);
strDescription=
L"Your component may not be" \
L" configured";
}
// Exit and cleanup code
exit_cleanup:
if (NULL != pContextState)
{
if (SUCCEEDED(hRetval))
pContextState->SetMyTransactionVote(TxCommit);
else
pContextState->SetMyTransactionVote(TxAbort);
pContextState->SetDeactivateOnReturn(VARIANT_TRUE);
pContextState->Release();
}
if (NULL != pConn)
{
if (adStateOpen==pConn->GetState())
pConn->Close();
pConn=NULL;
}
if (SUCCEEDED(hRetval))
return hRetval;
else
return Error((LPOLESTR)strDescription,IID_IBook,hRetval);
}
// Book.h : Declaration of the CBook
#ifndef __BOOK_H_
#define __BOOK_H_
#include "resource.h" // main symbols
/////////////////////////////////////////////////////////////////////////////
// CBook
class ATL_NO_VTABLE CBook :
public CComObjectRootEx<ccommultithreadmodel>,
public CComCoClass<cbook, &clsid_book="">,
// public IObjectControl,
public ISupportErrorInfo,
public IDispatchImpl<ibook, &iid_ibook,="" &libid_articleprojectlib="">,
public IObjectConstruct
{
public:
CBook()
{
}
DECLARE_REGISTRY_RESOURCEID(IDR_BOOK)
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(CBook)
COM_INTERFACE_ENTRY(IBook)
COM_INTERFACE_ENTRY(IObjectConstruct)
// COM_INTERFACE_ENTRY(IObjectControl)
COM_INTERFACE_ENTRY(ISupportErrorInfo)
COM_INTERFACE_ENTRY(IDispatch)
END_COM_MAP()
// ISupportsErrorInfo
STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
// IObjectControl
// public:
// STDMETHOD(Activate)();
// STDMETHOD_(BOOL, CanBePooled)();
// STDMETHOD_(void, Deactivate)();
// CComPtr<iobjectcontext> m_spObjectContext;
// IBook
public:
STDMETHOD(xStr)(/*[out, retval]*/ BSTR* returnval);
STDMETHOD(RetrieveByID)(/*[in]*/ BSTR id,/*[out,retval]*/ _Recordset** rs);
STDMETHOD(Construct) (IDispatch *pCtorObj)
{
_bstr_t strDescription;
HRESULT hRetval;
IObjectConstructString *pStr;
BSTR strConstruct;
if (pCtorObj != NULL)
{
hRetval=pCtorObj->QueryInterface(IID_IObjectConstructString,(void **)&pStr);
if (SUCCEEDED(hRetval))
{
hRetval=pStr->get_ConstructString(&strConstruct);
if (SUCCEEDED(hRetval))
{
mConnectionString=strConstruct;
SysFreeString(strConstruct);
}
pStr->Release();
}
elsentabitab pConn->Open(mConnectionStri pConn->Open(mConnection
{
_com_error err(hRetval);
strDescription=err.Description();
ATLTRACE(err.ErrorMessage());
}
}
else
{
hRetval=E_POINTER;
strDescription=L"An invalid pointer was passed to Construct";
}
if (S_OK==hRetval)
return hRetval;
else
return Error((LPOLESTR)strDescription,IID_IBook,hRetval);
}
private:
_bstr_t mConnectionString;
};
#endif //__BOOK_H_
|
|
|
|