|
Hi all
Imconfused by a daft problem..
Our apps are written using MFC (CStrings etc) but we are using a library which uses ATL (strings). I understand string is a basic string but cant get my head around this simple problem...
I cannot assign a string longer than 15 chars...
To show an example..
string s1;
CString cs1;
cs1 = m_sRootURL.Left(10);
s1 = cs1.GetString(); // ok
cs1 = m_sRootURL.Left(12);
s1 = cs1.GetString(); // ok
cs1 = m_sRootURL.Left(14);
s1 = cs1.GetString(); // ok
cs1 = m_sRootURL.Left(16);
s1 = cs1.GetString(); // not ok, s1 = "5rf"
All help etc.. etc...
|
|
|
|
|
I don't really understand your question. When you say "I understand string is a basic string" do you really mean: a BSTR?
If your ATL component requires data to be input as a BSTR you can use CString::AllocSysString in MFC to allocate a BSTR and copy a Cstring's contents into the BSTR. Then you can pass the BSTR to the ATL library.
Robert
|
|
|
|
|
i have created an activex control using COM/ATL and then i placed my activex control into Word document using following
function.
CComVariant varClsType("Ascertia.AscertiaObj.1");
MSWord::InlineShapePtr MyObj =
m_pWordApp->Selection->InlineShapes->AddOLEObject(&varClsType);
Now my activex control has different get and set properties like Caption,
BKColor,MyData etc. I want to access and modify those properties after executing the above 2 lines of code from within MSWord.
anybody there to give me a hand.
Thanks in advance.
Ahmad Jalil Qarshi
|
|
|
|
|
Hi,
I'm designing an application that consists of ONLY a wizard. I use this code to show it.
int Run(LPTSTR /*lpstrCmdLine*/ = NULL, int nCmdShow = SW_SHOWDEFAULT)
{
CMainWizard wizard;
if ( IDOK == wizard.DoModal() )
{
}
return 0;
}
The rest of the code is default wizard code.
It all works perfectly but when i close the wizard with the cancel button i get a first chance exeception. It think this is because Run() always returns zero.
What should i do to let it exit in an ordinate fashion? Thnx
|
|
|
|
|
i dont think that the error is caused by your return code, you need to step into the code on the cancel button handler and try to "isolate" the line that causes the exception, watch variables and go line by line till you find out whats wrong.
If you still cant find whats wrong, post the code for your CMainWizard class so we can help you find the problem.
HTH
|
|
|
|
|
hi guys
i have create three Interfaces in a class which is create by ATL Object Wizard
this Interfases defines as under:
IA,IB,IC
IA derived from IDispatch
IB derived from IA
IC derived from IA
could you tell me how to write the 'BEGIN_COM_MAP' etc for my case?
thinks a lot
I love programming, but my english is too bad (
|
|
|
|
|
Currently, I have a COM event which I've created a sink for and all of that jazz. It receives events at the Invoke method of course. Then i use dispIdMember to figure out which event was called. The only problem is that the event is fired from a different thread as the rest of my program, which poses a huge problem. Is there a way that I can call a function on threadA from threadB?
|
|
|
|
|
one way to do this is to create a hidden window on threadA and then post a message on threadB to the threadA hidden window.
If you need to wait for the process to finish before threadB continues then use sendmessage not postmessage.
Best of luck
Forever Developing
|
|
|
|
|
hi!
i want to persist binary data read from a file into my ActiveX object. i have tried to do that using VARIANT containing SAFEARRAY of BYTES but couldn't do that. furthermore i tried to do same by using directly SAFEARRAYs of bytes, but unfortunately i couldn't. It seems that its not possible to store VARIANT containing SAFEARRAY of bytes as well as direct SAFEARRAYS of bytes. Am i right?
if its possible then please tell me how to do that. Is there any other way to do that?
Thanks in advance.
Ahmad Jalil Qarshi
|
|
|
|
|
There is already an Automation-compatible type for holding a block of bytes - BSTR . Use SysAllocStringByteLen() to allocate the BSTR . (Normally BSTR s are used to hold C-style strings, but that's not mandatory.)
--Mike--
LINKS~! Ericahist | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ
Strange things are afoot at the U+004B U+20DD
|
|
|
|
|
Thanks Mike!
You solved my problem. you are really great. I was working on it since last 2 weeks. nobody guided me towards using BSTR. but now when i see so simple solution with the help of you great person i am so happy.
Thanks a lot.
Ahmad Jalil Qarshi
|
|
|
|
|
How to fix (custom ActiveX)control size in design time.
I am using MFC ActiveX ControlWizard.
Please help me.
Thanks
David Park
|
|
|
|
|
How to lock child window from resizing in MDI ?
I am using WTL + MDI/Dialog framework.
- CMDIFrameWindowImpl<MAINFRAME>
--- CMDIChildWindowImpl<MY_FRAME>
----- CDialogImpl<MY_FRAME_VIEW>
i tried to set-up window styles (below) on creating... but child window then freezing :/ and i can do nothing with it (move/minimize)
Style to setup for not-resizing window:
~WS_THICKFRAME;
~WS_MAXIMIZEBOX;
i have example, but it built on Document/View technology...
http://www.thecodeproject.com/dialog/resizeformtofit.asp
----------------------------
never stop coding.
|
|
|
|
|
use the WM_NCCALCSIZE msg to set the dimensions of the dialog to the same min/max size, use it in the frame
regards
|
|
|
|
|
hi
i'm want to use new GNU comipler
the problem is with hash_map interator
after reading some articles i added some extra macros but the didn't solve the problem
compiler seems to do not recognize type
template <typename Data>
or
template <class Data>
and in line
hash_map<int, Data>::interator ptr;
throws an error: expected `;' before "ptr"
here is whole code
<code>
#include <string>
#include <ext/hash_map>
#include <iostream>
#include <iterator>
#if defined(__GNUC__) && (__GNUC__==2) && (__GNUC_MINOR__>=95)
/*STL extensions were put in the std namespace ...*/
namespace gnuext = std ;
#elif defined(__GNUC__) && (__GNUC__>=3)
/* STL extensions have their own namespace */
namespace gnuext = __gnu_cxx ;
#else
#error "This code relies on non-standard STL extensions as defined by GNU libraries."
#endif
#if defined(__GNUC__) && (__GNUC__==2) && (__GNUC_MINOR__>=95)
/*STL extensions were put in the std namespace ...*/
#define __GNUEXT std
#elif defined(__GNUC__) && (__GNUC__>=3)
/* STL extensions have their own namespace */
#define __GNUEXT __gnu_cxx
#else
#error "This code relies on non-standard STL extensions as defined by GNU libraries."
#endif
template <typename Data>
class MyHash {
MyHash() {}
~MyHash() {}
__GNUEXT::hash_map<int,Data> myhash;
void add(Data d)
{
__GNUEXT::hash_map<int, Data>::iterator ptr;
}
};
<code/>
Pain is a weakness living the body
|
|
|
|
|
ravjak wrote:
__GNUEXT::hash_map::iterator ptr;
try:
typename __GNUEXT::hash_map<int, data="">::iterator ptr;
|
|
|
|
|
bingo
thans
Pain is a weakness living the body
|
|
|
|
|
|
Goodmorning!
As the subject line suggests I am having a hard time with the persistance of
my ATL ActiveX control's Font Stock Property and the selection being
remembered once its made. I thought I was doing it all wrong but then to
make sure I had the code right, I made a brand new project with a brande new
control that had the Font stock property as a feature from the very
beginning. I also told the wizard to add the background colour property for
testing sake.
So i compile it and then try to use it in another project....I insert it
into the dialog and then right click to get the properties. I can select the
background colour, and the setting remains. I click on the font property, the
font window comes up with the collection of fonts..i make the selection...hit
OK/apply but the font field in the properties shows up as empty...it does not
actually remember the font I chose.
Like I said, I thought i might be doing something wrong and therefore tried
it out on a brand new control where the font property was added by Visual
Studio's wizard. Is this a little "bug"? and if so...how does one
exterminate/wack it.
Thanks!
Aristotel
|
|
|
|
|
Click me.[^]
We learned how to make Stock Font Propeties work here.
From get_hFont to Load and Save m_pFont.
|
|
|
|
|
hi!
I want to capture the right mouse button event on MS Word document.
is it possible? if so then please help me.
Thanks
Ahmad Jalil Qarshi
|
|
|
|
|
hi!
I have Added a new CommandBarControl of type msoControlButton in the Menu "Inline Picture" (which is displayed when you right click on some picture or some OleObject in MS Word Document). I have also run some VBA macros on click event at this new inserted menu Item by specifying them into PutOnAction function. But now i want to call some functions of my ActiveX control's class when the user right click on my control and then select the newly inserted menu item. Is it possible if so then please help me.
Thanks
Ahmad Jalil Qarshi
|
|
|
|
|
// call member function printWithPrefix() for each element
// - "person: " is passed as an argument to the member function
for_each (coll.begin(), coll.end(),
bind2nd((mem_fun_ref(&Person::printWithPrefix)),
"person: "));
this code from a book, dont compile on vc++.
I am disapointed.
Please. What to do ?
Vincent
|
|
|
|
|
I'm guessing that you're using Visual C++ 6.0. This version doesn't support a lot of the Standard C++ Library.
I recommend that you either use a later version of Visual Studio or download the Visual C++ Toolkit 2003[^], which includes the compiler tools from VS.NET 2003.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
I had the same and searched the error without success.
Recently I got VC7.1, I tried it again and it compiled perfectly!
So change your compiler or dont't use mem_fun_ref.
Christof
|
|
|
|