|
leary wrote:
send keystrokes of any kind
VOID keybd_event(
BYTE bVk,
BYTE bScan,
DWORD dwFlags,
DWORD dwExtraInfo
); or (on NT)
UINT SendInput(
UINT nInputs,
LPINPUT pInputs,
int cbSize
);
leary wrote:
left, right or middle mouse button clicks
VOID mouse_event(
DWORD dwFlags,
DWORD dx,
DWORD dy,
DWORD dwData,
DWORD dwExtraInfo
); or (on NT)
UINT SendInput(
UINT nInputs,
LPINPUT pInputs,
int cbSize
);
leary wrote:
setting the cursor position
BOOL SetCursorPos(
int X,
int Y
);
Hope that helps
-Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
|
|
|
|
|
Thanks,
hopefully this will get me up and running.
|
|
|
|
|
Hello!
I am working with views in sizeable dockin control bars (example http://www.codeproject.com/docking/dockview.asp)
but this is not really my problem.
What i need is to dynamically change the size of the underlying View-Class (CFormView) - In this example, the Size of the View is defined by the size of the Resource.
I tried to do this with the MoveWindow()-Funktion - but this cannot work, since this operates on the displayed window.
I need to create Controls dynamically and resize the view - so all controls can be displayed. The size of the displayed window should stay the same - only the scrollbar-ranges should chang as a reaction to the new size.
a million thanks if anybody can help me.
|
|
|
|
|
Hello Again!
I have now found a way to accomplish this. Maybe there are other ways, but I am very new to the MFC Framework (in fact, this project is my first work with MFC and the MDI)
I have changed the members CScrollView - Data Members
"m_totalLog" and "m_totalDev" with my new SIZE-Struct and Called the
OnSize() method of CScrollView to reflect the changes.
Now I can position new Elements on my view dynamically.
Anyway - maybe someone knows a better way, or find this information useful.
greetings from Austria
Martin
|
|
|
|
|
I have a SDI application with the view class derived from CRichEditView. The following code behaves different on one of of our machines:
long posError=0;
FINDTEXTEX text;
text.lpstrText="Error (";
text.chrg.cpMin=0;
text.chrg.cpMax=-1;
posError=GetView()->GetRichEditCtrl().FindText(FR_MATCHCASE|FR_WHOLEWORD, &text);
if(posError!=-1)
{
DoSomething...
}
On most machines it works fine and finds the lines containing "Error(" but on one machine it only works when I don't use the FR_WHOLEWORD flag in the FindText function. I never came across this problem ever before and can't imagine any reason for that. I'm "at the end with my latin" as we say in german. Does anybody have an idea ???
MS
|
|
|
|
|
Hi
I'm programming a plugin for an application, and I want to subclass the WindowProc of the main window to receive its messages and then forward them to the main window.
this is what I currently do:
WNDPROC pOrigProc = (WNDPROC)SetWindowLong(wndMainForm, GWL_WNDPROC, (LONG)HookWndProc);
This works, the WNDPROC will be redirected to my WindowProc:
LRESULT CALLBACK HookWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch(uMsg)
{
case WM_MOVE:
MessageBox(NULL, "WM_MOVING", "", MB_OK);
return 0;
break;
case WM_SYSCOMMAND:
if(wParam == SC_MINIMIZE)
return 0;
break;
default:
break;
}
return CallWindowProc(pOrigProc, hwnd, uMsg, wParam, lParam);
}
For some reason, neither the message box appears, nor will the main window be prohibited to me minimized, although I don't redirect the WM_SYSCOMMAND-message (return 0). But the windowproc itself gets called. So what's wrong here?
regards
Greg
modified 12-Sep-18 21:01pm.
|
|
|
|
|
It seems that you're subclassing a child of the main window.
If you're using MFC then wndMainForm must equal m_hWnd of the CFrameWnd -derived class.
rechi
|
|
|
|
|
Hi there
does ne1 know how to convert a string to a long
my string contains numeric characters
ie. mystring = "42309492"
or mystring = "-42342"
im using the below but its not working
char * pEnd;
long l;
l = strtol (mystring,&pEnd,0);
can ne1 help
thanks
si
|
|
|
|
|
|
Use the standard library with string streams
#include <sstream><br />
<br />
const char* buffer = "1023451235";<br />
istringstream iss(buffer);<br />
long myLong;<br />
iss >> myLong;
If you can keep you head when all about you
Are losing theirs and blaming it on you;
If you can dream - and not make dreams your master;
If you can think - and not make thoughts you aim;
Yours is the Earth and everything that's in it.
Rudyard Kipling
|
|
|
|
|
you can use atol(), as replied by the above post.
But the reason strtol() is not working in your code is because you havent specified the correct number base.
<br />
l = strtol(mystring, &pEnd, 10)<br />
"..Even my comments have bugs!"
Inspired by Toni78
|
|
|
|
|
Hi,
I have a problem with my ListCrtl. I use InsertColumn to set the headlines over my columns but I want, that the user can not move the headlines. They should be fix.
I hope somebody can help me how I can solve this problem.
Bye
Julia
|
|
|
|
|
if you use
CListCtrl& ctlList = (CListCtrl&) GetListCtrl();
// set the style of the list control
ModifyStyle ( LVS_TYPEMASK, LVS_REPORT);
ListView_SetExtendedListViewStyle (m_hWnd, LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES );
that set it so columns cant be moved
if you use
ListView_SetExtendedListViewStyle (m_hWnd, LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_HEADERDRAGDROP);
then you can move the columns
hope this helps
|
|
|
|
|
Thank you for your tip, but
can I realize that without ListView?
I have only a membervariable type listctrl in my class CBPageDlg : public CPropertyPage.
|
|
|
|
|
The terms "control" and "view" are confusing here.
The ListView_SetExtendedStyle macro works perfectly on "normal" CListCtrls.
Btw, you can also use (I recommend this) CListCtrl::SetExtendedStyle [DWORD SetExtendedStyle(DWORD dwNewStyle);] .
-Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
|
|
|
|
|
Hello Friends,
In my application I am using SQL Server's database. My database is already uploaded on Internet SQL server.
Hear is my problem:
If I dont have SQL server in my computer, then I get connection error when I am trying to open the connection with this server.
BUT if I have SQL server in my computer then it gets connected with that SQL server on Internet and works fine.
What is problem in this?
If some one knows the solution for this, then please tell me
Thanks
|
|
|
|
|
You probably are initially lacking the client connectivity components on your local computer, but you then get them when you install the SQL server locally.
You might also try just installing MDAC locally and then see if you can connect to the remote SQL server.
C++/MFC/InstallShield since 1993
|
|
|
|
|
Hi All
Can u help i have a sting which contains both Alpha and Numeric Characters
eg. mystring = "344RT",
however i want to remove all numeric characters
so im left with mystring = "RT"
does ne1 know the best function for doing so
thanks in advance
si
|
|
|
|
|
I would do the brute-force way:
mystring.Remove('0');
mystring.Remove('1');
mystring.Remove('2');
mystring.Remove('3');
mystring.Remove('4');
mystring.Remove('5');
mystring.Remove('6');
mystring.Remove('7');
mystring.Remove('8');
mystring.Remove('9'); Perhaps not the best solution, but it works
Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
|
|
|
|
|
Not tested, but this is what I initially thought of :
<br />
#include <ctype.h>
CString strAlphaOnly;<br />
TCHAR cMyString[] = _T("344RT");<br />
<br />
for(int nCount=0; nCount < len(cMyString); nCount++)<br />
if( isalpha( cMyString[nCount] ) )<br />
strAlphaOnly+=cMyString[nCount];<br />
"..Even my comments have bugs!"
Inspired by Toni78
|
|
|
|
|
i am trying to hide a window after using the animate window function. The code is as follows:
<br />
AnimateWindow(m_hWnd,500,AW_HIDE | AW_SLIDE | AW_VER_POSITIVE);<br />
<br />
this->ShowWindow(SW_HIDE);<br />
am not sure why this isnt working
|
|
|
|
|
The GDI+ Bitmap class has an ApplyEffect method and Graphics has a DrawImage, both of which take a pointer to an Effect based class.
Although the docs relating to Effect's are marked prelim they seem to imply that this functionality exists in the 1.1 GDI+ API accross all OS's.
1. How do i know what version of GDI+ i have when the dll is version 5.1.3097.0 and the headers in the latest PlatformSDK have no Effect definitions anywhere. Went through all the GDI+ headers and no metion of version anywhere. Return from GdiplusStartup says version is 1, but field is an ulong so couldn't represent 1.1 anyways.
2. Is GDI+ 1.1 a part of the .NET release (as i am still using VC++ 6 i wouldn't see it then)
3. All searches on MS (and the web) only turn up the 5.1.3097.0 version dll.
4. Why is there air ?
...cmk
Save the whales - collect the whole set
|
|
|
|
|
Here are some common terms:
1.DECLARE_DYNAMIC and IMPLEMENT_DYNAMIC
2.const CStudent& operator=(const CStudent& s)
{
...
}
3.BOOL operator ==(const CStudent& s) const
{
...
}
Can you tell me how to master these terms?
|
|
|
|
|
DECLARE_DYNAMIC and IMPLEMENT_DYNAMIC are MFC macros. You must use them if you want MFC's DYNAMIC_DOWNCAST macro, the RUNTIME_CLASS macro, and the IsKindOf method to work. Your class must be derived from CObject .
If using a newish version of C++ (VC 6.0 and later, IIRC), and not interfacing with older MFC code that uses these macros, I suggest sticking to the standard C++ dynamic_cast cast operator and the typeid operator. Note that these can't be used on Windows CE prior to version 4.0, as they require runtime library support that isn't available on CE 3.0 and below.
If you want to use DECLARE_DYNCREATE or DECLARE_SERIAL in a derived class, you must use at least DECLARE_DYNAMIC in your base class (otherwise your code will not compile). DECLARE_DYNCREATE enables dynamic creation of objects by MFC: this is required by the document/view framework for creation of document and view objects. DECLARE_SERIAL provides a default implementation of an operator << and operator >> for your class - this is used for object serialisation to a CArchive .
See the documentation topic CObject Class: Deriving a Class from CObject[^] for more information on these macros.
Item 2:
The operator keyword introduces a method that replaces the operator symbol mentioned: i.e. operator= replaces the normal behaviour of the = operator. If operator= is written as a member function, it will be used if the left-hand side of the assignment expression is of the type the operator= is a member of, and the right-hand side is of the type mentioned in the argument. Assuming that this operator= is defined in CStudent , this operator= will be used whenever one CStudent object is assigned to another.
The use of const here indicates that the return value of operator= cannot be modified by the caller, in the same way that the const on the argument indicates that s cannot be modified within the function.
Style note: In accordance with the guidance of 'do as the int s do', operator= should return a CStudent& , not a const CStudent& . See Effective C++[^] for more guidelines on implementing operator= .
Item 3:
operator== has much the same meaning as in #2, but this time we're replacing the == equality operator. We're comparing this against s .
The const at the end of the declaration says something different. It tells the compiler that this function may be called on CStudent objects that are const , i.e. they're read-only. Functions declared const may not modify member variables, unless they're declared mutable .
|
|
|
|
|