|
1、Get HWND of your dialog box.
2、Get HWND of edit.
3、use SetFocus() api.
eg:
HWND hDlg = ... //get hwnd of your dialog box.
HWND hEdit = GetDlgItem(idEdit);
SetFocus(hEdit);
i love vc!This will appear at the
end of messages you post
to the Code Project
|
|
|
|
|
Hai wang,
Thankyou for your valuable reply , it helped me a lot
Regards
george
|
|
|
|
|
I want to use two recent file lists in a SDI project, how to do?
Thank you very much!!
|
|
|
|
|
I am writing a attributed COM component in Visual Studio .NET 2003 (VC++ 7.1). For reusing the types defined in some other TLB, I want to import this TLB that I do by inserting the following line in stdafx.h.
[ importlib("test.tlb") ];
This 'importlib' attribute places this line in the library block of the IDL file. However, now if some of the interface methods in my COM component want to return an interface defined in test.tlb, it gives me IDL compilation error.
Perhaps, it is probably since the automatic IDL generation by the compiler puts all the interface declarations of my component outside the library block, and the importlib attribute generates the importlib line inside the library block... and, so the interface declarations of my component are not able to recognize the interface types defined in the imported type library.
Can anyone suggest me if I am importing the library in a wrong way, or if there is any other solution to it ?
Thanks & Regards,
Arun
|
|
|
|
|
This isn't meant to be snarky, but don't use attributed ATL. It's more headache than it's worth. Go with regular ATL and use #import to generate wrappers for the stuff in the TLB file.
|
|
|
|
|
Please insert "[ importlib("test.tlb") ];" in current .idl file.
eg:
[
uuid(95E822B6-6B10-4e86-9603-6CECB6135867),
version(1.0),
helpstring("xxxxx 1.0 Type Library")
]
library xxxxxLib
{
importlib("stdole32.tlb");
importlib("stdole2.tlb");
importlib("test.tlb"); //here insert!
...
}
good luck!
i love vc!This will appear at the
end of messages you post
to the Code Project
|
|
|
|
|
Hi all,
I have made an Internet Explorer toolbar. ToolBar is having only three buttons. I used TBBUTTON for making Buttons. I have loaded bitmaps on each button using following code.
myfun(){
CToolBarCtrl::Create(DEFAULT_TOOLBAR_STYLE, rcClP, pWndParent,IDB_BITMAP1))
AddBitmap(3, IDB_BITMAP1
TBBUTTON tbs[3];
for (int i = 0; i < 3; i++)
{
tbs[i].dwData = 0;
tbs[i].fsState = TBSTATE_ELLIPSES|TBSTATE_ENABLED ;
tbs[i].fsStyle = TBSTYLE_BUTTON;
tbs[i].iBitmap = i;
tbs[i].idCommand = ID_BUTTON1 + i;
tbs[i].iString = i;
}
AddStrings(_T(" Red\0"));
AddStrings(_T(" Green\0"));
AddStrings(_T(" Blue\0"));
if (!AddButtons(3, tbs))
return false;
return true;
} //function ends here
Here I am able to load bitmap on each buttons . But I need to add Icons on each button. How it possible
Please Help me
Thanks in Advance
George K Jolly
|
|
|
|
|
I don't know for sure, this question should be in the Visual C++ / MFC[^] forum to get more eyes on it. You might have to create your own image list and load the icon into it then set the image list TB_SETIMAGELIST into the toolbar control. See Toolbar Controls Overview[^] for more information.
led mike
|
|
|
|
|
I have used new ATL object to do OLE DB connection,bywhich i got table.h header file,and now i want to insert data in msaccess table by using following code...can anybody help me to solve my problem can you just tell me one thing first whether this way of using to insert data is correct or not...
and what changes should i make it here to correct it
.
<br />
m_TQuote.Open();
m_bInserting = FALSE;
DoModal();<br />
<br />
GetDlgItemText(IDC_EDIT1,m_TQuote.m_DateTimeStamp);<br />
GetDlgItemText(IDC_EDIT1,m_TQuote.m_MarketNo);<br />
GetDlgItemText(IDC_EDIT1,m_TQuote.m_Bid);<br />
GetDlgItemText(IDC_EDIT1,m_TQuote.m_MarketName);<br />
GetDlgItemText(IDC_EDIT1,m_TQuote.m_Ask);<br />
GetDlgItemText(IDC_EDIT1,m_TQuote.m_MarketState);<br />
<br />
HRESULT hr = 0;<br />
if (m_bInserting)<br />
{<br />
hr = m_Set.Insert();
}<br />
else<br />
{<br />
hr = m_Set.SetData();
}<br />
m_bInserting = FALSE;<br />
<br />
|
|
|
|
|
I create a composite control and add a toolbar on it.
For that toolbar, how should I provide Tooltip?
Thanks in advance.
Regards
Amar.
|
|
|
|
|
Hi
I have written a plugin but don't know how to register it so that i can use it.
can anybody tell me how can i register a plugin.
regards
sAqIb
"Our scientific power has outrun our spiritual power. We have guided missiles and misguided men."
Dr. Martin Luther King Jr.
|
|
|
|
|
regsvr32 <path to="" plugin="">
should suffice
use
regsvr32/u <path to="" plugin=""> to unregister it
redindian
|
|
|
|
|
thanks dear. i will test it soon
regards
sAqIb
"Our scientific power has outrun our spiritual power. We have guided missiles and misguided men."
Dr. Martin Luther King Jr.
|
|
|
|
|
Does anyone know why CoCreateInstance for IShellWindows fails if called by an IE extension running in windows service?
Code for creating service:
SC_HANDLE hSCM = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
if (!hSCM)
{
WriteMainLog(_T("INSTALL: OpenSCManager error."));
return FALSE;
}
SC_HANDLE hService = ::CreateService(hSCM,
SERVICE_STR_ID,
SERVICE_STR_ID,
SERVICE_ALL_ACCESS,
SERVICE_WIN32_OWN_PROCESS |
SERVICE_INTERACTIVE_PROCESS,
SERVICE_AUTO_START, // start condition
SERVICE_ERROR_NORMAL,
gszFileNewPath,
NULL,
NULL,
NULL,
NULL,
NULL);
if( !hService )
{
WriteMainLog(_T("INSTALL: CreateService error."));
return FALSE;
}
....
hr = CoCreateInstance(__uuidof(SHDocVw::ShellWindows),
NULL,
CLSCTX_ALL,
IID_IShellWindows,
(void**)&spShWin);
if( FAILED( hr ) )
{
_com_error er(hr);
_stprintf(err, _T("[MTProcessesInfo::GetURLInformation]. spShWin.CoCreateInstance. %s\r\n"), er.ErrorMessage());
WriteSpyLog(err);
return FALSE;
}
Error: "Class isn't registered".
|
|
|
|
|
Didn't you like my answer in the other thread you started for this ?
Try This First
at least try what I suggested first before reposting on a different board.
anyway this is a COM question, not an ATL/STL or WTL one.
-- modified at 10:47 Friday 27th October, 2006
Darka [ Xanya]
"I am not a slave to a god that doesn't exist."
|
|
|
|
|
Hi
Question 1:
When we create an COM object in a Process where does the memory of the COM objects get allocated?
Question 2:
Does the memory allocated to the COM object contributed to increase in Virtual memory of the process where it is instantiated.?
Question 3:
What is the relation between virtual memory of a process and private bytes of the process?
for Ilanthendral(KillerInstincts)
for thendral
|
|
|
|
|
When we create a COM Object in a Process memory of the COM Objects get allocated in 'Heap Portion' allocated to the process.
And yes memory allocated to the COM Object contributes to increase in virtual memory of the process.
And regarding third question, actullay I could understand what you are trying to ask? Can you please clarify 'private bytes' of the process.
Thanks,
Suraj
Suraj Gupta
|
|
|
|
|
IElementBehaviorFactory* pEBFactory = NULL;
//Create my com object of implementing IElementBehaviorFactory interface
CoCreateInstance(CLSID_Factory, NULL, CLSCTX_INPROC_SERVER,IID_IElementBehaviorFactory, (void**)&pEBFactory);
//Mashal IElementBehaviorFactory
hr = CoMarshalInterThreadInterfaceInStream(IID_IElementBehaviorFactory, pEBFactory, &pStm);
The return value hr is 0x80004002, why?
The default value of [HKEY_CLASSES_ROOT/Interface/{3050F429-98B5-11CF-BB82-00AA00BDCE0B}/ProxyStubClsid32] is {B8DA6310-E19B-11D0-933C-00A0C90DCAA9}.
{B8DA6310-E19B-11D0-933C-00A0C90DCAA9} is the class id of actxprxy.dll.
I think that actxprxy.dll is the proxy/stub for IElementBehaviorFactory, but I don't know why CoMarshalInterThreadInterfaceInStream call fail for IElementBehaviorFactory.
|
|
|
|
|
With the help of new ATL object i have done OLEDB connection and now table.h header file is created in my project with all the table field varaible in that...now i want to insert Data from remote server to msaccess database..but i dont know how to do coding for that..can anybody help me...to do coding...how to start..if any question pls ask and try to help me..
Thank you
|
|
|
|
|
|
We have a function which has the following signature
SomeFunction(TCHAR* szPassword,TCHAR* szEncryptPwd)
Now we need to pass in a std::string as the first parameter,and convert the second parameter back into a std::string on return.
How is the conversion from std::string to TCHAR* and back to std::string done?
|
|
|
|
|
|
Hello,
Just use W2A(…) macro. More information on MSDN.
Regards,
Leonid
|
|
|
|
|
Hi. I'm new to writing Active-X controls and have a few quesitons which I couldn't find answers for in the archives. Here's what I'm trying to do. If you have a better suggestion, please respond.
We are using Visual C++ 6.0 and EVC++ 4.0 and ATL (no MFC). I want to create a collection of ActiveX controls which will all be derived from one base control so I can use a vector of them in a container window. My main quesiton:
- Is it even possible to derive new ATL ActiveX controls from a base ATL ActiveX control? I'm thinking like in regultar C++ if I create a base ActiveX control for, say, a button, then derive other types of buttons from that and override their OnDraw() or OnPain() methods, I can just have a vector of these base buttons. Am I off in left field?
Thanks,
Mark.
Mark Malin
Software Developer
GE Healthcare
|
|
|
|
|
markjmalin wrote: Am I off in left field?
More like left-center.
No you cannot derive from ActiveX controls because you cannot derive from COM objects.
markjmalin wrote: I can just have a vector of these base buttons.
For what purpose is the vector? Not to use the OnDraw() or OnPaint() methods right? All COM objects already share a common interface "IUnkown", so technically you could store that in the vector, but for what purpose?
led mike
|
|
|
|