|
|
A much easier solution is just to write a little program that listens on one port, and writes everything it receives to target port. Its a pretty standard concept (a proxy), and if you do a search on google for 'tcp tunnel' then you'll find lots of programs that will do it for you
|
|
|
|
|
|
|
What is it about the slider control that it wants to stay in the last place it was at on a window. I close the window and when I go back even thought I do a SetPos(0) it is still hanging around the last place it was left.
Any ideas on how to make it move back?
Thanks,
Jim
|
|
|
|
|
Recheck your code. Otherwise, call Invalidate().
Kuphryn
|
|
|
|
|
Not like I want a new control or anything. I just want to Derive the CAsyncSocket class in a DLL. Then I want to override the virtual members (all the "on..." functions) and add some of my own, like pre-parse buffers and such.
My purpose is to load the DLL in Visual Basic. It seems a heck of a lot more work, in the long run, to write and existing object and a new object for each other, instead of writing one that I can use in place of the two.
What do I need to do (#include, list in compile command-line, etc.) to make it compile properly as a DLL.
Then, how do I instantiate one in VB so I can go about using it?
--M.Pemrich
----------------------------------------------------
Just kinda lost everywhere. And as if lost wasn't lost
enough... I got a book on the subject...
|
|
|
|
|
Somebody out there may well correct me, but I don't think you can call a conventional C++ class from VB without cracking the mangled names and passing the this pointer across.
However it's not all bad news. .NET allows you do use (and inherit) classes across threade boundaries, so you can quite happily use a C# class derived from an MC++ class in a VB.NET app.
Chris Maunder wrote an article on the subject you might find of interest:
Cross language inheritance in .NET[^]
Anna
www.annasplace.me.uk
"Be yourself - not what others think you should be" - Marcia Graesch
Trouble with resource IDs? Try the Resource ID Organiser Add-In for Visual C++
|
|
|
|
|
hi,
maybe a dumbquestion...
i want to know wenn a key is pressed in my dialog and witch key is pressed. how do i do it?
thanks in advanced...
Willem
[]D [] []D []
|
|
|
|
|
If you go into the Class Wizard under the message maps tab you can select WM_KEYDOWN or WM_KEYUP from the messages section. Once selected add a function to the event and edit the code in the function. The function takes in a parmeter called nChar.
convert nChar to a regualr character by using something like
char myChar;<br />
myChar = char(nChar);
then to find what key was pressed you can do simple comparisons like
if (myChar =='A')<br />
{<br />
}
Michael Shuster
Good Judgement comes from experience; Experience comes from bad judgement.
|
|
|
|
|
tracking WM_KEYDOWN should do it. There's much information about it on MSDN.
|
|
|
|
|
Hi, if tried it and it didn't work, maybe i should add that i want to override the input of inputbox to make my user interfase more keyboard-based.
[]D [] []D []
|
|
|
|
|
Howdy'
I have a UI with a ControlBar ( CSizingControlBar ) that contains a dialog and sub dialogs ( panels ).
The Panels need to be aware when they get the focus.
I tried handling WM_SETFOCUS, WM_ACTIVATE and WM_NCACTIVATE, and I don't receive the messages.
I now handle WM_LBUTTONDOWN to "simulate" the wanted behaviour, but I don't like it, and wandered if I'm missing something ?
Thanks.
Maximilien Lincourt
For success one must aquire one's self
|
|
|
|
|
CString m_test;
sBuffer[2] = "\xE8";
m_test.Format("0x%x", sBuffer[0]);
when i display on the edit box, i get this output
0xffffffe8
it looks like it sign extend the value, any other way to solve it so that i can get 0xe8 instead of 0xffffffe8
regards
afender
|
|
|
|
|
m_test.Format("0x%02x",sBuffer[0]) could work. Haven't used a CString for a while though.
Have a look at boost::format at http://www.boost.org[^] if you like your type safety.
Ryan
They read good books, and quote, but never learn
a language other than the scream of rocket-burn.
Our straighter talk is drowned but ironclad;
elections, money, empire, oil and Dad.
|
|
|
|
|
it still not working, seems like i cant limit the field width
|
|
|
|
|
afender wrote:
sBuffer[2] = "\xE8";
I've had problems like this before, too. It appears that your literal string is actually 4 characters long: slash, x, E, and 8.
Using the format string "0x%02x" will give you a two-character field with an automatic leading zero, if the source value ends up having only one char.
This DOES work, so if your's doesn't, there there is something else wrong.
Dave
"You can say that again." -- Dept. of Redundancy Dept.
|
|
|
|
|
int nVal = 0xffffffe8;<br />
strBuffer.Format("0x%x", nVal & 0xFF);
As far as I am aware fromatting will no truncate the value, it it was:-
BYTE nVal = 0xe8:
It would format as you wanted it.
If I have seen further it is by standing on the shoulders of Giants. - Isaac Newton 1676
|
|
|
|
|
The %x format takes an unsigned int , not a char , so Format() is reading 4 bytes off the stack when you only passed 1 byte of parameters.
Change it to
m_test.Format("0x%x", (unsigned) sBuffer[0]);
And to be extra-spiffy, you can use %#x to automatically add the 0x prefix.
--Mike--
The Internet is a place where absolutely nothing happens.
-- Strong Bad
1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
Hi! I'm a sig virus. Attach me to the end of your sig to help me take over the world!
|
|
|
|
|
hei thks for a ll the helps!
i solve the problem!!
|
|
|
|
|
Hi all-
I'm completely stuck. I am trying to dynamically set buttons on a CToolbar object using SetBitmap() via a memory dc. The code I have is below:
// begin code block
void CBitmap_toolbar2View::OnInitialUpdate()
{
CWindowDC dc(this);
CDC memdc;
memdc.CreateCompatibleDC(&dc);
CBitmap bm;
VERIFY(bm.LoadBitmap(IDR_MAINFRAME));
CBitmap *poldbm = memdc.SelectObject(&bm);
// draw into the dc/bitmap
CBrush brush;
brush.CreateSysColorBrush(COLOR_BTNFACE);
HICON theIcon = (HICON)LoadImage(AfxGetInstanceHandle(),
MAKEINTRESOURCE(IDI_ENTRY), IMAGE_ICON, 0,
0,
LR_DEFAULTCOLOR);
VERIFY(::DrawIconEx(memdc,
0,
0, // dc, x, y
theIcon, // HICON (first small one)
GetSystemMetrics(SM_CXICON), // cx
GetSystemMetrics(SM_CYICON), // cy
0,
brush,
DI_NORMAL)); // frame, brush, flags
DestroyIcon(theIcon);
theIcon = (HICON)LoadImage(AfxGetInstanceHandle(),
MAKEINTRESOURCE(IDI_ORDER),
IMAGE_ICON,
0,
0,
LR_DEFAULTCOLOR);
VERIFY(::DrawIconEx(memdc,
32,
0, // dc, x, y
theIcon, // HICON (first small one)
GetSystemMetrics(SM_CXICON), // cx
GetSystemMetrics(SM_CYICON), // cy
0,
brush,
DI_NORMAL)); // frame, brush, flags
memdc.SelectObject(poldbm);
((CMainFrame*)GetParentFrame())->m_wndToolBar.SetBitmap((HBITMAP)bm.Detach());
((CMainFrame*)GetParentFrame())->m_wndToolBar.Invalidate(TRUE);
((CMainFrame*)GetParentFrame())->m_wndToolBar.SetButtons(NULL,2);
}
//// end of code block
I made the toolbar in the frame public just to make it easier to play with.
So I have two icons that I want to set on the toolbar. The two calls to DrawIconEx() sets the first icon at 0,0 and the second one at 32,0 but what I see is the first icon twice. I have zero clue as to why I should see the first icon twice, especially when I call DestroyIcon() between DrawIconEx() and LoadImage() for the second icon.
Any help would be appreciated, this is something of a showstopper and I have no way of getting around it right now.
Ron
|
|
|
|
|
Why don't you use a regular toolbar bitmap strip?
Steve S
[This signature space available for rent]
|
|
|
|
|
The problem is that the toolbar is variable....the buttons that would appear in the toolbar, as well as their order, are variable. In addition, I already have several dozen ico files which would all have to be mushed together into one big bitmap.
|
|
|
|
|
Hello,
I would like to sort a vector(vlines), this is a vector with struct's(line).
I want to sort the vector on name and on length.
struct line{<br />
CString name;<br />
double length;<br />
};<br />
<br />
vector<line> vlines;
I know there is a function sort and that it uses a predikaat function.
<br />
std::sort(vlines.begin(), vlines.end(), length<line>());<br />
std::sort(vlines.begin(), vlines.end(), name<line>());<br />
But how can i code the predikaat function's? or template's??
I hope someone can help me?
Thanks
|
|
|
|
|
Those predicates are anything (functions, objects) that can be called with the same syntax as a function. So, even a function can do; for instance:
inline bool compare_line_by_length(const line&x,const line& y)
{
return x.name<y.name;
} can be fed to std::sort like this:
std::sort(vlines.begin(), vlines.end(), compare_line_by_length);
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|