|
Mmmmm - $(WindowsSdkDir)\include is the one that contains WinUser.h , which contains SetDlgItemText (well, actually SetDlgItemTextA and SetDlgItemTextW ).
Soooo - guess the first thing you could try is cleaning your build and rebuilding it (maybe the pre-compiled header's got itself confused?), then the next thing you could try is running your .cpp file that doesn't compile through the C pre-processor (use cl -P or set the relevant options in your project settings) on your machine and also a machine where it does build and check for differences between the pre-processor output - the definition of SetDlgItemText obviously isn't getting through the pre-processor to the compiler.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
I seem to remember running into this a few years ago, but I don't remember the specifics.
Have you googled it? My guess is that you haven't.
EDIT - It may have had something to do with the CFormView...
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Hi There.
I have a Dialog based Application: Title "ABC Application"
I want to launch this appiication and then want to set an edit box available on this window with some text.
This is what I am doing right now.
ShellExecute(NULL, L"open", L"C:\\Program Files\\ABC.exe", NULL, NULL, SW_SHOWNORMAL);
HWND WndOST2PST = NULL;
WndOST2PST = ::FindWindow(NULL,L"ABC Application");
if(WndOST2PST == NULL)
return false;
SendMessage(WndOST2PST, WM_DESTROY, 0, 0);
I am not able to get handle of that specific edit control. Please provide some pointers for the same.
Thanks
PanB
|
|
|
|
|
hi,you'd better get the window handle from one variable.
the dialog title may be not right in this course.
|
|
|
|
|
you can do this by EnumChildWindows API. See the See the sample snippet[^]
-Sarath.
"Great hopes make everything great possible" - Benjamin Franklin
|
|
|
|
|
Try this
CString Text;
CWnd *pWnd = FindWindow(NULL, "Title");
CWnd *pChildWnd = pWnd->GetWindow(GW_CHILD);
while(pChildWnd)
{
UINT uiID = pChildWnd->GetDlgCtrlID();
pChildWnd->GetDlgItemText(uiID, Text);
pChildWnd->SetDlgItemText(uiID, "Test");
pWnd->SendMessage(WM_COMMAND, MAKEWPARAM(uiID, BN_CLICKED), (LPARAM)pChildWnd->m_hWnd);
pChildWnd = pChildWnd->GetWindow(GW_HWNDNEXT);
}
|
|
|
|
|
Use this to set data into text box
SendMessage(_Edithwnd, WM_SETTEXT, 0, (LPARAM)strCaption);
|
|
|
|
|
Hello to all,
i need to read a RTF file via iostream and convert it internally into plain text. The plain text should be searched for some keywords ... and the text between these keywords should be stored into an other (different) file.
The problem is not to read the RTF via iostream.
The problem is to skip all these formatting instructions of the RTF, because i need only the plain text.
Solving that, i need some code snippet ... but i haven't found something like that.
Additionally, the code should not use COM, DCOM, Automation of MS Word or somthing like that. Just a peace of C++ code.
Anybody out there ... having an idea how-to or look-where ???
Thank's for any idea.
|
|
|
|
|
This article[^] is in C#, but probably covers the basics so you could write a C++ version
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hi,
In my application I am having dialog .I am receiving images from mobile and I am displaying Images on dialog. I have added vertical scroll bar to dialog.I am creating 8 static controls programatically on dialog and I am using these 8 static controls for Image display. At a time I am displaying 8 Images on Dialog.I am using Scroll bar to display all Images. I have written following code in my "displayImage" function.for every scroll I am calling this function.
for(int i = 0; i < 8; i++)
{
if((i != 0)&&(i%4 == 0))
{
x1 = 1;
x2 = 250;
y1 = y1+355;
y2 = y2+355;
}
myStatic[i] = new CStatic();
myStatic[i]->Create(_T(""),WS_CHILD|WS_VISIBLE|SS_BITMAP,
CRect(x1,y1,x2,y2),this);
image.Load(Image);
HBITMAP hbmp = image.Detach();
if(hbmp == NULL)
{
Error = GetLastError();
}
if(hbmp != NULL)
myStatic[i]->SetBitmap(hbmp);
}
First 8 Images are displaying Properly.After that If I scroll Scroll Bar dialog is showing first 8 Images first and It is displaying second 8 images.If I scroll third time it is showing first 16 images after that it is showing third 8 images and so on.Can anyone help me.
|
|
|
|
|
Probably your data structure is not getting cleared and still holds the images that you displayed earlier. Debug to check
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
|
|
|
|
|
I am facing this issue since few days. I tried so many options but no use
1)I deleted myStatic[i] variables after using static controls.
If I do that dialog is not showing any Images.here myStatic is local variable.
2) I declared member variables m_myStatic[8].No use.
|
|
|
|
|
Of course you delete the static control variables. But where and how do you store the images that later on get displayed in these static controls. My previous question was whether you clear the data from the structure and not the static controls themselves.
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
|
|
|
|
|
I have made static control variable array as member variable.
In display Image function I am deleting static control variable array before creating new Static controls.
My code is working fine.Thanks for your reply
|
|
|
|
|
Dear all;
Recently our organization needs to convert a 3rd party’s MFC class library into managed code for usage in .NET. In the SDK, there is a header file and a dll library.
I only have little knowledge on wrapping unmanaged code to managed code. I would much appreciate if any one could give advice on how to implement.
Below shows the code in the header file for the dll library. Inside the “MainClass”, there are nested class, callback function and nested struct.
////////////////////////////Header File///////////////////////////////////////////////////////
#pragma once
#ifdef UNMANAGEDCODE_API_EXPORTS
#define UNMANAGEDCODE_API __declspec(dllexport)
#else
#define UNMANAGEDCODE_API __declspec(dllimport)
#endif
#include <sys/timeb.h>
class UNMANAGEDCODE_API MainClass
{
public:
MainClass ();
Virtual ~MainClass ();
Virtual bool StartUp(const TCHAR* pcszConfigFileName = NULL);
class NestedClass1
{
public:
// This is the entry for call back function
virtual bool OnNestedClass1() = 0;
};
Bool SetCallback(NestedClass1* callback); typedef struct NestedSruct1
{
unsigned int unId;
__timeb64 createTime;
}NestedStruct1;
const NestedStruct1** GetData(unsigned int& unCount);
};
////////////////////////////End of Header File///////////////////////////////////////////////////////
modified on Thursday, March 19, 2009 2:05 AM
|
|
|
|
|
anybody can help?
Thanks a million!
|
|
|
|
|
Try wrapping it in a managed C++ library. Basically, call the MFC DLL from within the managed C++ library, and then call the managed C++ library from your code. This is the easiest way to do it.
You will need delegates for the callbacks in the managed part. Search for it. There are examples of doing this all over the place.
|
|
|
|
|
Thanks for the kind reply, David.
Yes, now I learned how to wrap the class functions in a managed c++ library. But I am stuck with the callback function. Previously in our unmanaged C++ applications, in order to use the callback function in the legacy dll, we can just create a new class inheriting the NestedClass1 and implement the virtual function in the new class.
Below is the header file in the legacy dll.
///////////////////////////////
//Legacy dll header file
class MainClass
{
public:
class NestedClass1
{
public:
// This is the entry for call back function
virtual bool OnNestedClass1() = 0;
};
Bool SetCallback(NestedClass1* callback);
}
//End of legacy dll header file
//////////////////////////////
//Below codes shows how to use the call back function
/////////////////////////////////////////////////////
class NestedClass1Child:public NestedClass1
{
MainClass m_mainClass;
void Initialize()
{
m_mainClass.SetCallback(this);
}
virtual bool OnNestedClass1()
{
//Here I insert my code to get the data
int result = RetrieveData();
return true;
}
int RetrieveData()
{
return m_mainClass.GetData();
}
};
///////////////////////////////////////////////////////
As you can see from the above example in unmanaged C++, I just need to implement a child class of the NestedClass1 and then implement the virtual function "OnNestedClass1()".
But the issue now is: the managed class cannot inherit unmanaged class. I am wondering if the delegate is suitable for this case.
I would much appreciate if you could highlight more.
Thank you
Frank
David Knechtges wrote: Try wrapping it in a managed C++ library. Basically, call the MFC DLL from within the managed C++ library, and then call the managed C++ library from your code. This is the easiest way to do it.
You will need delegates for the callbacks in the managed part. Search for it. There are examples of doing this all over the place.
|
|
|
|
|
Problem Statement:
SetWindowsHookEx() won't permit the 2nd parameter to be a function in a class. Therefore, I have created a separate global function in my .cpp file "MouseHookWndProc" that will be called. However, how is it possible to reach functions in my (Dialog) class from the global function "MouseHookWndProc" ?
Source code:
S2000_CP_DLG::S2000_CP_DLG(CWnd* pParent) : CDialog(S2000_CP_DLG::IDD, pParent)
{
mouseHook = SetWindowsHookEx(WH_MOUSE, (HOOKPROC)MouseHookWndProc, GetModuleHandle(NULL), NULL);
}
LRESULT CALLBACK MouseHookWndProc(int nCode, WPARAM wParam, LPARAM lParam)
{
if (nCode < 0)
return CallNextHookEx(mouseHook, nCode, wParam, lParam);
char chTempText[100];
sprintf(chTempText,"MouseHook:0x%X",wParam);
return CallNextHookEx(mouseHook, nCode, wParam, lParam);
}
class S2000_CP_DLG : public CDialog
{
DECLARE_DYNAMIC(S2000_CP_DLG)
public:
void CpMessage(char* pszMessage, int nVal);
CEdit m_editMessages;
}
My Attempt to solve it:
The obvious solution for me was to make CpMessage() a static (as well as the m_editMessages since that member variable is used by the function).
This compiled, however Linking failed:
error LNK2019: unresolved external symbol "public: static class CEdit S2000_CP_DLG::m_editMessages" (?m_editMessages@S2000_CP_DLG@@2VCEdit@@A) referenced in function "protected: virtual void __thiscall S2000_CP_DLG::DoDataExchange(class CDataExchange *)" (?DoDataExchange@S2000_CP_DLG@@MAEXPAVCDataExchange@@@Z) S2000_CP_DLG.obj
void S2000_CP_DLG::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Control(pDX, IDC_MESSAGES, this->m_editMessages);
}
The problem persists... and unfortunately adding "this->" to the DoDataExchange() didn't work
does anyone have any recommendations ?
|
|
|
|
|
Create a global pointer of your class.
S2000_CP_DLG* pThis = 0;
In the constructor or the OnInitDialog function assign the address of the object to the pointer.
pThis = this;
Now you can access the class members using pThis .
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
nice!
pThis->CpMessage(chTempText,0);
compiled and linked without a hitch.
|
|
|
|
|
I am new user for SOM. how can i design a SOM of 15 neurons in a 3X5 rectangular grid.I am badly stuck up with this problem. Any answers.
|
|
|
|
|
What's a SOM ? a quick google does not return anything, hmm, usefull.
What have you done ? What have you research so far ?
Assuming it's for homework, how about asking your teacher, teachers' assistant, fellow students, ...?
This signature was proudly tested on animals.
|
|
|
|
|
Hello All,
A little question about memory allocation. Yes, nos and look heres greatly accepted...
I'm not sure how to word the question so I'll say what I want to do:
I want to, from one program, allocate a block of memory noting its memory address/pointer. When this program finished I do not want to free up this memory location but rather be able to access it from a second program and be guarenteed of what I'll find there. Basically I want to be able to take this address and, in a completly seperate program, access this memory and then deacllocate/free it up.
Is this possible?
Thanks...
|
|
|
|
|
You can used shared memory, though the second program would have to start and open the shared memory before the first exited.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|