|
Thanks for the reply.
still no luck, now it displays corrupted final dialog with finish button.
Regards,
Mushtaque Nizamani
|
|
|
|
|
Why to give a call to the dialog when you intend to kill it explicitly without user intervation?
BTW did you try PressButton(PSBTN_FINISH)
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
|
|
|
|
|
Hi. I'm trying to send an array of UDT from Excel VBA to a C++ dll but have no idea which direction I should look. Here's what I'm trying to do
MyTestDLL.cpp
#pragma pack(4)
struct MyCppType
{
short iVal;
double dVal;
BSTR bstr;
};
#pragma pack()
void _stdcall MyDllFunction (array of MyCppType)
{
}
MyTestDLL.def
LIBRARY "MyTestDll"
EXPORTS
MyDllFunction @1
MyTestExcel.xlsm
Option Explicit
Declare Sub MyDllFunction Lib "MyTestDLL.dll" (arr() As MyVbaType)
Type MyVbaType
iVal As Integer
dVal As Double
sVal As String
End Type
Sub Test()
Dim arr(2) As MyVbaType
arr(1).iVal = 1
arr(1).dVal = 1.1
arr(1).sVal = "one"
arr(2).iVal = 2
arr(2).dVal = 2.2
arr(2).sVal = "two"
MyDllFunction (arr)
End Sub
I've posted this problem on the VB forum and was advised to post it here. Please help ![Sigh | :sigh:](https://codeproject.global.ssl.fastly.net/script/Forums/Images/smiley_sigh.gif)
|
|
|
|
|
Hi I need to do the same thing. Can anyone give any pointers to it plz....
|
|
|
|
|
Hi,
I using MFC in my Application.My Application single document Application. I have selected Document/view architecture support and Unicode Libraries.
I want to Print Images in ListBox. I have created one Dialog which is having ListBox and added class to it. I have written one Abstract class. In that I have decleared Pure virutul functions.
class CDrawC
{
protected:
virtual void DrawItem(LPDRAWITEMSTRUCT lpdis, bool bHasFocus) = 0;
virtual void MeasureItem(LPMEASUREITEMSTRUCT lpmis) = 0;
virtual void InitLBox(CListBox* pLBox) = 0;
virtual int AddItemLst(CListBox* pLBox, char* Item) = 0;
friend class CODrawLBox;
};
I have derived class from above class and overriden the functions DrawItem(),MeasureItem() and AddItemLst().
class CPicDrawC : public CDrawC
{
public:
CPicDrawC() : PicSizeX(200), PicSizeY(200) {}
const int PicSizeX;
const int PicSizeY;
protected:
virtual void DrawItem(LPDRAWITEMSTRUCT lpdis, bool bHasFocus);
virtual void MeasureItem(LPMEASUREITEMSTRUCT lpmis);
virtual void InitLBox(CListBox* pLBox) {}
virtual int AddItemLst(CListBox* pLBox, char* nItem);
};
I have created ListBox variable and changed its type to CODrawLBox Class type which is derived from CListBox.
class CODrawLBox : public CListBox
{
DECLARE_DYNAMIC(CODrawLBox)
public:
CODrawLBox();
virtual ~CODrawLBox();
void SetDrawC(CDrawC* pDrwC) {
m_pDrawC = pDrwC;
}
void Init() {
m_pDrawC->InitLBox(this);
}
int AddItem(char* Item)
{
return m_pDrawC->AddItemLst(this, Item);
}
protected:
DECLARE_MESSAGE_MAP()
public:
virtual void MeasureItem(LPMEASUREITEMSTRUCT );
virtual void DrawItem(LPDRAWITEMSTRUCT );
protected:
CDrawC* m_pDrawC;
};
In the OninitDialog of Dialog I am using following code to display images.
char* path = new char[128];
strcpy(path,"C:\\ProgramFiles\\MTAF\\Reports\\Tc_1_11032008_083859123_2.bmp");
m_picList.AddItem(path);
Images are not displaying in ListBox.I am sure I am missing something.what will be the reason.
Regards,
Rekha.
|
|
|
|
|
hemlat wrote: .I am sure I am missing something.what will be the reason.
On the information given, you could be missing a lot of things.
1/ Why have you got a pure virtual class? That makes no sense to me.
2/ Is you list box owner draw? You need to pick Owner draw fixed or Owner draw variable.
3/ If you have the owner draw style set, the listbox will send WM_MEASUREITEM messages to your dialog box. You need to have a afx_msg void OnMeasureItem( int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct ); member function in your dialog box, and ON_WM_MEASUREITEM( ) in your message map to route messages to the function.
4/ Similarly, you'll need afx_msg void OnDrawItem( LPDRAWITEMSTRUCT ); / ON_WM_DRAWITEM( )
You could also look here on codeproject for listboxes that do owner draw things already. I know I've posted some combobox articles which are similar.
Good luck,
Iain.
Codeproject MVP for C++, I can't believe it's for my lounge posts...
|
|
|
|
|
Hi thanks for your replay.
My ListBox is owner draw variable.
I have overriden functions of CDialog.Those functions are
virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
virtual void MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct);
I will try using Messages Maps
Rekha
|
|
|
|
|
If you do not have the entries in your message map, then MFC will not bother calling your functions. Simple as that.
Try using class wizard - it's quite good at adding these sort of entries.
Iain.
Codeproject MVP for C++, I can't believe it's for my lounge posts...
|
|
|
|
|
In the extension dll, I do not accept or reject request from client.I just get the attributes and write them to txt file,and then let IAS deal with the request.
In this way,if client request using PAP,I can get the ratUserPassword in txt file.
If client request using CHAP,I can get the ratCHAPPassword in txt file.
But if client request using MS-CHAP,I can get neither ratUserPassword nor ratCHAPPassword.
Please attention :
1) I do not accept or reject request in extension dll.
2) With my extension dll,VPN and IAS work perfect.Client can connect to VPN and pass the IAS's Authentication.
I can not understand why I can get neither ratUserPassword nor ratCHAPPassword if client request using MS-CHAP. ![Cry | :((](https://codeproject.global.ssl.fastly.net/script/Forums/Images/smiley_cry.gif)
|
|
|
|
|
I've a third-party console application 'MyTestConsole.exe' that I launch by CreateProcess.
STARTUPINFO StartUpInfo;
PROCESS_INFORMATION ProcInfo;
memset(&StartUpInfo, 0, sizeof(StartUpInfo));
memset(&ProcInfo, 0, sizeof(ProcInfo));
StartUpInfo.dwFlags = STARTF_USESHOWWINDOW;
StartUpInfo.wShowWindow = SW_SHOWNORMAL;
CreateProcess( "D:\\MyTestConsole.exe", NULL, NULL, NULL, NULL, CREATE_NEW_CONSOLE, NULL, NULL, &StartUpInfo, &ProcInfo);
The console application launches successfully, but displays a standard windows error message, say for instance
'Error : could not open file'
Now, how do I get the error string 'Error : could not open file' in a CString object.
May be I'll have to use AttachConsole() and other console functions but not sure how.
Pleae give your suggestions.
Thanks in advance.
|
|
|
|
|
This example[^] shows how to use a pipe to capture output from a child process - that's what you're wanting to do.
To summarise what the example does:
- Create a pipe to capture the child processes standard output and error streams (that's the console output).
- Make sure the current processes standard handles aren't inheritable
- Use the
lpStartupInfo parameter to CreateProcess to specify the pipe as the child processes standard stream handles - Keep reading the pipe attached to the child's standard output until it's closed
HTH!
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
|
Hey everybody
How can a get an hToken (or CAccessToken) for a cached (saved) network user name?
If you run "rundll32.exe keymgr.dll,KRShowKeyMgr" you will get a dialog with cached usernames/passwords (can be found in control panel->User Accounts).
Is there a way to get a token to these usernames? (like explorer.exe is doing).
I need that when I want to access a remote file on a shared folder that can be accessed only using one of these cached usernames.
Thanks!
|
|
|
|
|
i have created a combobox in my dialog based application. and added items in it by clicking its propesties's data tab....added items saperated by semicolons...but these are invisiable to me.... how can i see them so that i can then use them..........reply me urgently...plzzzz
|
|
|
|
|
What do you mean by invisible ? They are not added to the combo box ? How do you add the items ?
Are you sure they are not added to your combo box but outside the range ? You can increase the visible range of your combo in the resource editor: if you click on the combo box arrow, you can set the size of the drop down rectangle instead of the size of the combo.
|
|
|
|
|
Instead of putting semicolon, why don't you use Ctrl+Enter to enter the data?
|
|
|
|
|
i hav tried both the things semicolon and Ctrl+enter but could view the items is there any other setting also????
|
|
|
|
|
Normally if u enter the items in the combo box using Ctrl+Enter and run the application, what ever you have entered will be displayed in the combo box.
by the way, can u see the combo box in the screen??
|
|
|
|
|
1/ As already mentioned, you need to use Ctrl-Enter to separate the lines of data.
2/ You need to make sure you call CDialog::OnInitDialog in your OnInitDialog routine, or MFC won't do the clever things it needs to to load in your data.
BOOL CMyDialog::OnInitDialog ()
{
return CDialog::OnInitDialog ();
}
I hope that helped,
Iain.
Codeproject MVP for C++, I can't believe it's for my lounge posts...
|
|
|
|
|
Hey thanks for that... that was a good piece of information!!!! ![Smile | :)](https://codeproject.global.ssl.fastly.net/script/Forums/Images/smiley_smile.gif)
|
|
|
|
|
Hi,
I have a propreitary API which accepts char as a parameter. But I have a WCHAR variable. I need to typecast WCHAR variable to char.
Thanks
|
|
|
|
|
Use WideCharToMultiByte API.
|
|
|
|
|
Use WideCharToMultiByte .
«_Superman_»
|
|
|
|
|
Nope. You need instead a better understanding, see, for instance [^], [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hello friends
I got these errors when i compile my project.. i need ur suggestions..
include\winsock2.h(112) : error C2011: 'fd_set' : 'struct' type redefinition
include\winsock.h(54) : see declaration of 'fd_set'
include\winsock2.h(156) : error C2011: 'timeval' : 'struct' type redefinition
include\winsock.h(97) : see declaration of 'timeval'
include\winsock2.h(212) : error C2011: 'hostent' : 'struct' type redefinition
Thankx
|
|
|
|