|
Hi All,
Can anyone tell me how to return a VARIANT array value from the Activex to the host program , waiting...
Thanks and Regards
Alic
|
|
|
|
|
You need to use SAFEARRAY . I found this article [^] having its usage.
|
|
|
|
|
:-DThanks for your article!
|
|
|
|
|
As said use SAFEARRAY.
In ATL you can use CComSafeArray class. This class provides a wrapper for the SAFEARRAY.
S o h a i l K a d i w a l a
To Err Is Human; to Debug, Divine
modified 21-Apr-21 21:01pm.
|
|
|
|
|
ok, I will use CComSafeArray, Thanks!;P
|
|
|
|
|
Thanks everybody .
I hope you have a nice day!
Alic
2006-12-15
|
|
|
|
|
Hi there,
Is there a simple way to implement Ctrl-A as select all for all edit controls in a WTL dialog. I guess one way is to use a accelerator table and implement ID_EDIT_SELECT_ALL, but is there a nice way to reroute all edit accelerators to the focused edit control in a dialog window. Is there a better way?
Best regards,
E
|
|
|
|
|
You could write your own edit class that handles the Ctrl-A, and subclass each edit control on your dialog:
Partial class:
class CSelectEdit : public CWindowImpl< CSelectEdit, CEdit >
{
public:
....
BEGIN_MSG_MAP(CSelectEdit)
MESSAGE_HANDLER(WM_KEYDOWN, OnKeyDown)
....
END_MSG_MAP()
LRESULT OnKeyDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
if ( GetKeyState(VK_CONTROL) < 0 && wParam == VK_A )
{
SendMessage( EM_SETSEL, 0, -1 );
return 0;
}
bHandled = FALSE;
return 1;
}
};
Then in your dialog class, create a member variable for each edit control:
CSelectEdit m_edit1;
The in your OnInitDialog, subclass each edit control:
m_edit1.SubclassWindow( GetDlgItem( IDC_EDIT1 ) );
Well, that's one way to do it anyway.
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
In List view control "report view", horizontal scroll bar should not be seen and only vertical scroll should be visible when needed.
I tried using "NO SCROLL" property option but it removes both the scroll bars but i want only horizontal scroll to be removed.
Kindly help me in solving this problem.
Guru
|
|
|
|
|
Hi All,
I'm awaiting for information on this...
Please can any one help me...
Guru
|
|
|
|
|
Hi All,
Can anyone tell me how to read the contents (words) of a text file into a vector/ list? I may be asking a very basic question but I am just a beginner. Hope you all understand.
Thanks and Regards,
Anil
|
|
|
|
|
Try something like this:
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <iterator>
#include <algorithm>
int main()
{
using namespace std;
fstream fs("C:\\Words.txt");
if (!fs)
{
cerr << "Failed to open file!" << endl;
return 1;
}
vector<string> WordList;
typedef istream_iterator<string> StringsIT;
copy(StringsIT(fs), StringsIT(), back_inserter(WordList));
copy(WordList.begin(), WordList.end(), ostream_iterator<string>(cout, "\n"));
return 0;
}
Steve
|
|
|
|
|
Thanx Steve!!![ ]
|
|
|
|
|
why would you do someone's class assignment for them?
led mike
|
|
|
|
|
If it's really an assignment the teacher will know straight away: some who can't program in C++ properly using back inserters, stream iterators and algorithms is a dead giveaway. If your assumption is incorrect then I've helped someone out.
Steve
|
|
|
|
|
:-DI have a method of event interface,for examples declaration is Fire_MyEvent(VARIANT v), I make the variable v like this:
CComSafeArray<VARIANT> arr;
arr.Add(CComVariant(buffer));
arr.Add(CComVariant(m_sScreenName.c_str()));
arr.Add(CComVariant("AIM"));
arr.Add(CComVariant(list.c_str()));
CComVariant v(arr);
Fire_MyEvent(v);
It works well in my VC program, but when I used it in a Dephi program, there is a problem.
In dephi function like this:
OnMyEvent(OleVariant v), when run , the v is null, why?
ALIC
2006-12-13
|
|
|
|
|
Has anyone see the IE "Favorites" menu, it has the amazing abillity to accept files dragged inside the menu, you can also move items arround by dragging items up and down.
I've been told that i shuld manipulate the WM_MENUDRAG message, but MSDN has documented this very poorly, it seems that the documentation / source to archieve drag & drop on menus is very hard to find if not impossible.
Any tips ideas from u guys, are welcome !
|
|
|
|
|
I'm writing a ActiveX plugin to display video, I have problem on OnDraw method, I can't refresh received images on the display zone:
//Draw method:
HRESULT OnDraw(ATL_DRAWINFO& di)
{
RECT& rc = *(RECT*)di.prcBounds;
if( ImgBuff )
{
HBITMAP HBmp = CreateBitmap(ImgBuff->width,
ImgBuff->height,
1, 32, ImgBuff->data);
DrawState(di.hdcDraw, NULL, NULL,
(long)HBmp, NULL,
0, 0,
ImgBuff->width,
ImgBuff->height,
DST_BITMAP);
DeleteObject(HBmp);
}
else
{
.......
}
return S_OK;
}
//Buffering method
//this fonction bufferise recived image in ImgBuff
FrameReady(phVideoFrameReceivedEvent_t *ev)
{
ImgBuff = ev->frame_remote;
FireViewChange();
}
Thank you to say me how to redraw a new image the display zone??
Rachid
|
|
|
|
|
Hello
my pb is:
when I create a std::map in an exe and pass it to a object's method in a DLL, I can't access to the elements of the map (it crashs after the first access).
You can try this minimal code illustrating that.
(I work under visual C++ 6, but I think it's not the reason).
the code: a main.cpp file: the "application".
dll.h and dll.cpp : the dll with the object's method:
main.cpp___________________________
#pragma warning( disable: 4786 )<br />
<br />
#include <map><br />
#include <iostream><br />
#include <string><br />
#include "dll.h"<br />
<br />
int main ()<br />
{<br />
std::map<const std::string, std::string> l_map;<br />
std::map<const std::string, std::string>::iterator it;<br />
int i;<br />
<br />
l_map["1"] = "2";<br />
l_map["3"] = "4";<br />
l_map["5"] = "6";<br />
<br />
for (it = l_map.begin(); it != l_map.end(); it++)<br />
{<br />
std::cout << (*it).first << ": " << (*it).second << "\n";<br />
}<br />
<br />
CDll obj;<br />
obj.f(l_map);<br />
<br />
std::cin >> i;<br />
return 0;<br />
}
dll.h________________________________________
#pragma warning( disable: 4786 )<br />
<br />
#include <map><br />
#include <iostream><br />
#include <string><br />
<br />
#ifdef DLL_EXPORTS<br />
#define DLL_API __declspec(dllexport)<br />
#else<br />
#define DLL_API __declspec(dllimport)<br />
#endif<br />
<br />
class DLL_API CDll<br />
{<br />
public:<br />
void f(std::map<const std::string, std::string>& p_map);<br />
};<br />
dll.cpp________________________
#include "dll.h"
<br />
void CDll::f(std::map<const std::string, std::string>& p_map)<br />
{<br />
std::map<const std::string, std::string>::iterator it;<br />
<br />
for (it = p_map.begin(); it != p_map.end(); it++)<br />
{<br />
std::cout << "DLL: " <<(*it).first << ": " << (*it).second << "\n";<br />
}<br />
}<br />
Thank you in advance for your help.
Nico
|
|
|
|
|
ledzzep wrote: You can try this minimal code illustrating that.
Its not crashing with given code. I'd tested it.
|
|
|
|
|
Did you compile the DLL with the same threading model and compiler as the EXE? If not, that's probably your problem.
|
|
|
|
|
Hello again.
A piece of "solution":
it seems only the map has this problem (but I don't try with a std::list for instance)
passing a vector of pair works.
But we loose the sort advantage of the map (I don't car in this case, ouf )
Maybye the problem is the implementation of the stl map in microsoft visual C++ 6.0 (I don't try to compile yet with other compilos)
|
|
|
|
|
I suspect you need to compile the code with a DLL version of the C run-time library. Otherwise, the EXE and DLL use different heaps, which causes problems when you pass things with heap-allocations (like STL containers, for example!) from EXE to DLL and vice-versa.
To change the run-time library version, open the project's settings and select the C++ tab. Then select 'Code Generation' in the 'Category:' drop-down list. Then, in the 'Use run-time library:' drop-down list, select 'Multithreaded DLL' (for a Win32 Release configuration) or 'Debug Multithreaded DLL' (for a Win32 Debug configuration).
HTH!
|
|
|
|
|
Bingo. I'd bet that's what's going on here.
Steve
|
|
|
|
|
See my answer here[^].
P.S. Cross-posting is considered a bad practice.
|
|
|
|