|
I want that whenever i type char : and ) it should be replaced.I am using following approch .
void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
{
CRichEditCtrl::OnChar(nChar, nRepCnt, nFlags);
uPervChar=uNextChar;
uNextChar=nChar;
if(uPervChar==_T(':')&&uNextChar==_T(')'))
{
nEnd=GetWindowTextLength();
nBeg=nEnd-2;
SetSel(nBeg,nEnd);
ReplaceSel("");
}
}
It wroks fine .But its slow .Is there any other way pls tell me.
Learner always
|
|
|
|
|
I need to check somehow when a process starts or exit. Any ideas how we can do this?
|
|
|
|
|
You have to set a HOOK on process of type WH_CBT and listen for WM_QUIT,WM_CREATE Messages.
Api:- SetWindowsHookEx
"I Think this Will Help"
Alok Gupta visit me at http://www.thisisalok.tk
|
|
|
|
|
I am trying to get data using OLEACC. It works fine when I fetch data from windows xp machine, however it fails to retrieve unicode data from Richedit20A control on windows 2000 machine. It gives ?????? for any of the unicode characters entered.
Anyone have any idea.
|
|
|
|
|
If it works on XP is should work on 2000. Usualy the only time you see ? marks is when the system can not translate from one character code format to anouther. May be you should try making sure that the 2000 machine is up to date as far as the OLEACC is concerned.
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
I updated my machine after I found this error.
I even used accexplorer to check if this is some problem with my coding and as I thought, result was all the same, even accexplorer cannot get the data.
I found version numbers of dlls being used by these systems are different with XP having the latest, so I replaced those that I can, but no luck.
|
|
|
|
|
I have a list ctrl and want to sort it when user click the column. In my sort function, i only can get the item's lparam, but i need get the item's index then could use GetItemText function to compare two strings. I find i could use the FindItem to get the item index from the item's lparam, but it seems slow(if items more than 3000, the sort time is too long). So could any one teach me which function or which way I could use to get the item index effectively?
Thank you very much for your help!
|
|
|
|
|
|
Mike, Thank you very much! You really help me!
|
|
|
|
|
Are you calling the list control's SortItems() method? If so, the callback function will receive two LPARAM variables, lParam1 and lParam2 . Those are pointers and need to be cast to the same type of object that was used with SetItemData() . For example:
struct myStruct
{
int i;
char name[32];
};
...
int nIndex = InsertItem(...);
myStruct *p = new myStruct;
SetItemData(nIndex, (DWORD) p);
...
SortItems(CompareFunc, 0);
...
int CALLBACK CompareFunc( LPARAM lParam1, LPARAM lParam2, LPARAM )
{
int nReturn = 0;
myStruct *p1,
*p2;
p1 = (myStruct*) lParam1;
p2 = (myStruct*) lParam2;
...
} Make sense?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Hello
How do I send a specific key to a winow?
I tryed using the SendMessage function like this:
SendMessage(hwnd,WM_KEYDOWN,'A',0x2701);
I think it doesn't work because of the 4th parameter and I don't understand that parameter very well.Can anyone explain it to me, it is supposed to be some kind of a value that identifies the repeat count, scan code, extended-key flag, context code, previous key-state flag, and transition-state flag, as shown in the following table. But I don't understand this.
I also tryed sending a hotkey message to the window as I think that the letter I send is actually a hotkey because it is underlined. I tryed doing that like this:
SendMessage(hwnd,WM_HOTKEY,IDHOT_SNAPWINDOW,'A');
But it didn't work. Why?
Is there some other way that I can press a button on this window programaticly? The buttons on this window keep changing every time you run it and they have no names just handles so that would be pretty hard.
|
|
|
|
|
The WM_KEYDOWN message is sent to a window when the window has focus and a non-system keyboard key goes down and remains pressed. After the keyboard repeat delay, multiple WM_KEYDOWN messages are simultaneously generated. A non-system keyboard key is any key excluding F10 and keys pressed together with ALT. To simulate an ALT + key combination, use WM_SYSKEYDOWN message.
In order to simulate a keypress to a window, use WM_CHAR message. WM_CHAR messages are not translated anymore, so the keycode you issue for it will proceed directly as-is to the receiving window. WM_KEYDOWN messages have virtual key-codes that are translated to character codes. WM_CHAR messages have character-code (ASCII) values with them.
To precisely simulate a keypress (such as CTRL/SHIFT + key), you must generate virtual keypress events. This is much more complicated than just sending a single message. Check SendInput in MSDN. In here, you will generate sequentical keyboard events for each and every event of the key combination. Remember that pressing CTRL + SHIFT + F, for example, consists of first setting CTRL, SHIFT and F keys to pressed state, in order, and then releasing them, in inverse order. Note that to target the keypress combination, you must set the target window active by using SetFocus .
Also, if your program is running on a seperate thread than the target program, you must first attach the input streams by using AttachThreadInput , and detach them after you've synthesized the keystrokes.
-Antti Keskinen
----------------------------------------------
"If we wrote a report stating we saw a jet fighter with a howitzer, who's going to believe us ?"
-- R.A.F. pilot quote on seeing a Me 262 armed with a 50mm Mauser cannon.
|
|
|
|
|
Hi-
I have a value 0xfffffff3 that is defined as:
exponent = 0xfffffff3 & 0xff000000 = 0xff
mantissa = 0xfffffff3 & 0x00ffffff = 0xfffff3
value = (mantissa) * (10^exponent)
This works find for positive numbers, but isnt for negative numbers. The true value is -1.3. But I keep getting 16777203 which is the 0xfffff3 in decimal, but should be -13 which becomes -1.3 once I do the multiplication.
Is there a way to convert this 2s complement value into the correct signed integer value?
I tried shifting left then right (0xfffff3 << 2) >> 2, but it doesnt seem to fill in the most significant bits w/ the correct sign.
Thanks.
-C
|
|
|
|
|
Integer values are 2s complement values. All you lack is the sign extension.
if (mantissa & 0x800000) mantissa |= 0xff000000;
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
...that shows the corresponding text from the String Table when you hover the mouse over a String Resource ID in code?
That would be great!
Thanks,
Ian
|
|
|
|
|
The grandaddy[^] of VS addins.
Provides what you need and so much more
It is a commercial app, so you will have to pay for the privilege
I Dream of Absolute Zero
|
|
|
|
|
Hi,
I am beginner in vc++, in my current project, I have one issue, I want some help from you.
I am creating, server socket & am listening for the clients. Once we have client, I am creating a seperate thread for that client.
Everything is done & working fine with this.
But, now the issue is, suppose Client socket is broken some how, & at that time if server sends the client the reply message, & if on client machine any firewall is installed, it treats the reply from the server under NMAP XMAS.scan.
to avoid this, before responding to the client, server should check wether client is alive or not, suggest me how can I do this?
|
|
|
|
|
You can't in the general case. Get a copy of TCP/IP illistrated by Richard Stevens to understand why (all volumns). (He died a few years ago, but the book is still worth reading, even if slightly dated)
The short of it is, the only way you know a client is alive is if you send data and it responds, and then you only know it was alive at the time it responded, which is always some time before you got the result. (normaly less than a second, but in the case of space craft can be hours!)
There are TCP/IP keep alives, but the time out is far too long to be useful for most purposes.
|
|
|
|
|
Hi !! All
i m facing Fixup linker error in my module. i have searched on internet and found that this problem arises when the memory model is not suitable for the application. to overcome this problem we must have the large memory model. i m using TC V3.0 and set the memory model to large , the program runs but when the function containing the bulitin function of c execute error occurs and programm exits from the dos shell. plz help me in fixing this error ? should i change some thing in my program?? i m using low level system programming in the code likes using the mouse interrupts and video interrupts? plz suggest some solution ASAP.
Best Regards
Thanks
Naina Khawaja
|
|
|
|
|
I considered replying with "This is the VC++ forum, not the Turbo C forum" but that would be so cliché. The only reason I mention it is that you may not get any help at all unless there happens to be a Turbo C user in the house. For me, it's been over 11 years since I've used that compiler.
I do not know an exact answer to your problem but with 16-bit code, being aware of the program's memory model was always very important. Crossing over into another program's address space was always a possibility and oh-so-easy to do with the segment:offset addressing scheme.
nainakhawaja wrote:
...the program runs but when the function containing the bulitin function of c execute error occurs...
How about showing us a code snippet and the error message? There are no guarantees but at least that would be a start.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Should I even bother using DrawDragRect or just write my own by using SetROP2?
DrawDragRect wouldn't draw off the window size so when I scroll up/down it won't follow along.
Someone mentioned in earlier post about using translate function for DragDractRect but I can't seem to find the function. With translation would it be possible drag a rectangle while scrolling down?
|
|
|
|
|
Anonymous wrote:
Someone mentioned in earlier post about using translate function for DragDractRect but I can't seem to find the function.
It's a member of the CDC class.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
I have look through but I can't find the function that does the translation
|
|
|
|
|
Hmm! I have never used DrawDragRect(), but your question implies that you have a scrolling problem and not a drawing problem. This sounds like you want the window to scroll, much like the window scrolls when you are trying to select more text (w/mouse) than you can actualy see (automatic scrolling). You have to issue the scroll command your self when the edge of the rectangle reaches the edge of the window you want it to scroll. The best way to do this, that I have used, is to start a timer and check the edge position in the timer function and have it issue the scroll commands (based on the edge position). The reason you would use a timer is because, if you do not, it would scroll way to fast.
You might look for articles on simple text editors to see how they are handling the scrolling when a user is dragging a mouse.
Good Luck!
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
I've already found quite some "niceties" regarding VC6 and function templates (template parameter must occur as argument, and template over type rather than typename isn't resolved correctly).
I found new one, that boils down to:
<br />
template <typename CHAR, typename STRLEN> void Foo(CHAR const * p, STRLEN lenFunc, size_t charsize)<br />
{ ... };<br />
<br />
Foo("Hello", strlen, 1);<br />
Foo(L"Hello", wcslen, sizeof(wchar_t);<br />
I haven't reproduced this in minimum code yet, but it's pretty obvious that the compiler (sometimes) uses just the wchar_t overload for both branches.
Q:
- is this valid code under the piercing eyes of the C++ standard?
- Is this a known problem for VC6?
- Is something known about VC7 / other compilers?
we are here to help each other get through this thing, whatever it is Vonnegut jr. boost your code || Fold With Us! || sighist | doxygen
|
|
|
|
|