|
Norm Almond wrote:
You function pointer need to be static
Nope, but this is a workaround.
static void funcA(LPVOID lpp, CMyClass* pThis);
when you call funcA pass in a pointer to your class, now you can have full access.
Normski. - Professional Windows Programmer
|
|
|
|
|
You call addEntry like this:
c.addEntry(a,1000,(pt2func)c.funcA,(LPVOID)&a); //ERROR
and you declared it like
voidid addEntry (pt2func lpfunc , LPVOID lpparam);
How sould it convert a char to a pointer to function?
Best regards,
Alexandru Savescu
|
|
|
|
|
is there a way to set the enter key to work like a tab key when moving through different cedit controls? or would i have to create a keypress event for each control?
|
|
|
|
|
Yes there is. Override your PreTranslateMessage function as follows:
BOOL CMyDialog::PreTranslateMessage(MSG* pMsg)
{
if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_RETURN)
{
CWnd *pWnd = GetFocus() ;
if (pWnd != NULL)
{
CEdit *pEdit = static_cast<CEdit*>(pWnd) ;
if (pEdit)
{
pMsg->wParam = VK_TAB ;
}
}
}
return CDialog::PreTranslateMessage(pMsg);
}
This converts all return presses to tabs so that it should tab from control ro control instead.
Roger Allen
Sonork 100.10016
If I'm not breathing, I'm either dead or holding my breath.
A fool jabbers, while a wise man listens. But is he so wise to listen to the fool?
|
|
|
|
|
That should have read
CEdit *pEdit = static_cast<CEdit*>(pWnd) ; // returns NULL if its not a CEdit* control
but the HTML parser stripped it out
Roger Allen
Sonork 100.10016
<small>If I'm not breathing, I'm either dead or holding my breath.</small>
<small><b>A fool jabbers, while a wise man listens. But is he so wise to listen to the fool?</b></small>
|
|
|
|
|
|
I got the problem, that the combobox can be edited by the user. but i just want him to choose from my values in the list.
the option of "DROPDOWN LIST" isn't of use, cause i have to tell the combobox which value it should have, everytime the dialog comes up.
so my aim: a list field, where i can define the initialsing value.
knows somebody any solution?
|
|
|
|
|
I cannot see why the combo box style CBS_DROPDOWNLIST isn't of any use since it does exactly what I guess you want: disabling the edit box of your combo.
If you want to populate your list, or set it to an initial value, do it in a handler for WM_INITDIALOG. That way your combos list will be initialized before your dialog is shown.
|
|
|
|
|
If i disable the Editbox by using CBS_DROPDOWNLIST, the dropdown field is empty, even if i initialised the variable with 0. so i want the 0 to be (pre)chosen from the list (values from 0 to 3). when i use dropdownlist, the dropdown cant be edited, but is also blank when the dialog comes up...
do you understand what i mean???
|
|
|
|
|
If your using MFC (???)
try the following in your
BOOL CDDDDIalog::OnInitDialog()
{
CDialog::OnInitDialog();
m_wndCombo.AddString("#1");
m_wndCombo.AddString("#2");
m_wndCombo.AddString("#3");
m_wndCombo.SetCurSel(0);
return TRUE;
}
If you're not using MFC, in your handler for WM_INITDIALOG, try something like:
::SendMessage(hWndCombo, CB_ADDSTRING, 0, (LPARAM)"#1");
::SendMessage(hWndCombo, CB_ADDSTRING, 0, (LPARAM)"#2");
::SendMessage(hWndCombo, CB_ADDSTRING, 0, (LPARAM)"#3");
int nIndex = 0;
::SendMessage(hWndCombo, CB_SETCURSEL, nIndex, 0);
|
|
|
|
|
trying to compile a Visaul C++ dll for a VB application.
what setting must I set.
I have created the following heading:
#define CEEPROGS
extern "C" // need for 'C' & VB progs
{
#ifdef CEEPROGS
declspec(dllexport)
#else
int APIENTRY CVDDLL_Main(char *Src,int Srclen,char *DestName,char *ErrorLog);
#define OURCALLING APIENTRY
#endif
}
and from the VB side I declared it as:
Public Declare Function CVDDLL_Main Lib "cvddllmain.dll" (ByVal sFile As String, _
ByVal iLen As Integer, _
ByVal sFileDesc As String, _
ByVal sErrorLog As String) As Integer
now everytime i call CVDDLL_Main I get a bad dll calling convention error?
Confusios say "Man who run in front of car get tired, Man who run behind car get exhausted."
|
|
|
|
|
the function dec i use:
extern "C" int __declspec(dllexport) __stdcall MakeQuery (long nUseAvailable,DWORD searchjob_id,DWORD search_id,DWORD user_id);
the function def line:
int __declspec(dllexport) __stdcall MakeQuery(long nUseAvailable,DWORD searchjob_id,DWORD search_id,DWORD user_id)
the vb module entry:
Public Declare Function MakeQuery Lib "qdbprint.dll" _
Alias "_MakeQuery@16" (ByVal uservailable As Long, ByVal SearchJobID As Long, ByVal search_id As Long, _
ByVal user_id As Long) As Integer
hope this helps
---
"all's fair in love and war but in love there is no geneva convention"
|
|
|
|
|
why ;
Alias "_MakeQuery@16"
do u have to include this?
Confusios say "Man who run in front of car get tired, Man who run behind car get exhausted."
|
|
|
|
|
it lets u use MakeQuery (in the example) instead of _MakeQuery@16 (which i believe is an illegal name in vb)
the @16 bit comes from the number of params u pass ... generally it seems to be 4 bytes per param
if you do it like this it will work
---
"all's fair in love and war but in love there is no geneva convention"
|
|
|
|
|
ok, I change my VB declaration:
Public Declare Function CVDDLL_Main Lib "cvddllmain.dll" Alias "_CVDDLL_Main@16" (ByVal sFile As String, _
ByVal iLen As Integer, _
ByVal sFileDesc As String, _
ByVal sErrorLog As String) As Integer
my c declaration still is:
#define CEEPROGS
extern "C" // need for 'C' & VB progs
{
#ifdef CEEPROGS
__declspec(dllexport) int CVDDLL_Main(char *Src,int Srclen,char *DestName,char *ErrorLog);
#define OURCALLING __declspec(dllexport)
#else
int APIENTRY CVDDLL_Main(char *Src,int Srclen,char *DestName,char *ErrorLog);
#define OURCALLING APIENTRY
#endif
}
but now i get this error:
Can't find DLL entry point _CVDDLL_Main@16 in cvddllmain.dll
Confusios say "Man who run in front of car get tired, Man who run behind car get exhausted."
|
|
|
|
|
ummmm
i dont see your __stdcall bit anywhere?
---
"all's fair in love and war but in love there is no geneva convention"
|
|
|
|
|
OHHHH!!!! THANKS YOU!!!!
/me very happy now.
)
))
thanks again for all you help. works like a bomb now!
Confusios say "Man who run in front of car get tired, Man who run behind car get exhausted."
|
|
|
|
|
Hi,
I have a pointer to an XMlDomDocument, and I would like to have an exactly the same copy of that DomDocument in to another XMLDomDoc ( the content, not the adress), I guess maybe is not so correct to think that with a copy constructor I will have it all solved ( or yes ?).
one *bad* idea about doin that is: get the XML string, and tell the other instance to generate the XML doc from that string... what that would be not very.... optimal...
Can you help me ?, Thanks in advance, Greetings
Braulio
|
|
|
|
|
It has a clone method, or at least the nodes do, so grab the top level node, and clone it when you insert it into a new document.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"I'm somewhat suspicious of STL though. My (test,experimental) program worked first time. Whats that all about??!?!
- Jon Hulatt, 22/3/2002
|
|
|
|
|
Mmm... but I´m afraid that it doesn´t work for the root node..
Thanks !
Braulio
|
|
|
|
|
Now I have a trouble with my project.
In my application, I want to send a byte to hardware port, example a address of printer port but I don't know how to do. Please help me!
Thanks!
TP
|
|
|
|
|
Take a look at the CreateFile() function. You can use this to open any kind of device. In the case of the printer port you would use something like:
HANDLE hLPTA = CreateFile("LPT1", ...) ;
You will then be able to use
ReadFile/WriteFile(handle) to send / get datat from the port.
Unfortunately, I dont have a full example on how to open the printer port, but I can give one for a serial port, with all the configuration calls.
Roger Allen
Sonork 100.10016
If I'm not breathing, I'm either dead or holding my breath.
A fool jabbers, while a wise man listens. But is he so wise to listen to the fool?
|
|
|
|
|
hi,
i posted a message yesterday but have not responses, and reading i thinks it's no well explained my doubt.
i have a managed class CNotificacionNet and unmanaged class CUNotificacionNet.
this is unmanaged code
#include "NotificacionNet.h"
class CUNotificacionNet : CFVNotificacion
{
public:
CUNotificacionNet(void);
~CUNotificacionNet(void);
sofianet::CNotificacionNet * m_pNotifiacion;
bool SetManagedNotifiacion(sofianet::CNotificacionNet*);
};
but when i build my project i recived this error:
c:\sofianet\UNotificacionNet.h(15): error C3265: cannot declare a managed 'm_pNotifiacion' in an unmanaged 'CUNotificacionNet'
any ideas to do it?
Thanks in advance
Salamanca 2002 Capital Cultural Europea, Visitala
|
|
|
|
|
I've been doing a lot of searching for this one, but finally struck gold in MSDN's C++ ME migration guide:
String * sTest = S"This is a test";
char __nogc* pcString = static_cast<char*>(Marshal::StringToHGlobalAnsi(sTest).ToPointer());
Just curious if many people are using this, or if there are other good methods to copy a managed string to an unmanaged char array.
|
|
|
|
|
For building an editor I'd need to know to how to create windows metafiles myself, and how to save them in the end.
Are there some free SDKs or are there already some solutions for pure MFC?
Thanks in advance,
Roland
|
|
|
|