|
BYTE str[200];
str[0] = 0x02;
str[1] = 0x03;
Hope this helps. A better solution is to have a structure representing the packet u send. Reply back if u want more info on this method.
Prashanth
|
|
|
|
|
Hi All,
Question: How can I support Automation in my WTL application?? E.g., I would Like to be able to do a
Obj.Visible = true (or false) and it will display the app., just like in IE??
Here is what I tried but it does not work:
I'm trying to create a WTL Application that supports Automation, but I have been unsuccessful so far. Here is what I do.
1. Create a WTL project called “Test” which is a “SDI Application”, and I create it as “Create as a COM Server” and I don’t “Use a view Window”
I compile it and it works just fine. The application is up and running. Now I insert a COM Object called “Application”, this COM Object contains one property, which is called “Visible”, and it’s a Get & Put property. I compile the project and it compiles just fine. Then I create a .VBS file and it looks like this
Set Obj = CreateObject(“Test.Application”)
Obj.Visible = True
The “Obj.Visible” generates an error:
Error: Library not registered
Code: 8002801D
However if I do an:
MsgBox IsObject(Obj)
Then it will return TRUE in the Message Box. However if I try and Register the Control from VS (Tools->Register Control) then I will get the following Error:
Test.exe was loaded, but the DllRegisterServer Entry point was not found. Test.exe does not appear to be a .DLL or .OCX (which is correct, its an .exe)
Any help would be great..
Thanks,
Jens
|
|
|
|
|
You didn't say what interface your Application object implements. Your COM object needs to be a dispatch interface in order for WSH or other scripting clients to use it.
--Mike--
http://home.inreach.com/mdunn/
Help! Help! I'm being repressed!!
your with and
Sonork - 100.10414 AcidHelm
|
|
|
|
|
Duel and IDispatch is used . But it still does not work.
-Jens
|
|
|
|
|
Hello everybody,
I would make to appear a menu on a right click
mouse. HOW?
Bye bye.
Giancarlo
Have a good day
|
|
|
|
|
Just handle the WM_RBUTTONUP message of any control or window (in MFC you might use the class wizard).
Inside your OnRButtonUp-function you can load a menu using CMenu->LoadMenu, then get the submenu
CMenu->GetSuvMenu(0) and finally call TrackPopupMenu
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Unless you specifically only want the menu on the right button, you should use WM_CONTEXTMENU, which is sent on a right button up, but is also sent if the user pressed the special context menu key on the keyboard, or uses the context menu shortcut (which I can't remember right at this point - ALT+F7?).
------------------------
Derek Waters
derek@lj-oz.com
|
|
|
|
|
If you know about the class, PLEASE!!!!
I've done this:
added files into my project and the includes in stdafx.h (afxsock.h, winsock.h and afxtempl.h)
then I made a varible in the dialog class:
CPop3Connection pop;
then I called Connect(...)
pop.Connect("server","user","pass", 8080);
and checked if there was any errors: Yes, the return value from the function was FALSE and it means not connected... what to do??
------------------------------
©0d3 ©®4©k3® - That's me!
------------------------------
|
|
|
|
|
Is there a simple way to set where you want the cursor to print in terms of only the x-axis on the screen? I am outputting results to a screen that look similar to a table of results from a database. I don't want to have to find the length of each item being output and then subtracting that from the total distance. I will know where the text should begin if it is possibly 'easy' to implement such a positioning. It would look similar to this.
data1 data2 data3 data4
data1 datathis2 dataso3 datamore4
datasda1 datahere2 data3 data4
Nick Parker
|
|
|
|
|
In my code, If the user uses File|Exit, I check to see if a file has been saved and offer the user options. How can I trap the user clicking the Close program box in the upper right hand corner, or using alt-F4 to close the program in order to prompt them to save or forget the program changes they have made.
Thanks in advance.
Steve S
|
|
|
|
|
The window should recieve the WM_DESTROY message. I'm unsure however if that would help you with your problem
Sprudling
|
|
|
|
|
|
How can I do an ownerdrawn window and which class should i use.......
|
|
|
|
|
Derive from CWnd and override OnPaint().
/ravi
"There is always one more bug..."
ravib@ravib.com
http://www.ravib.com
|
|
|
|
|
Does anybody have any idea why this program leaks ? It's a problem with STL or what ? I'm using VC++ 6.0, SP 5, W2K
#include <fstream>
#include <crtdbg.h>
using namespace std;
void test()
{
fstream fs("dbg.txt", ios::out);
fs.close();
}
void main(void)
{
test();
_CrtDumpMemoryLeaks();
}
|
|
|
|
|
It doesn't leak. The problem (if you can call it that) is that _CrtDumpMemoryLeaks is being called before global object destruction, thus it thinks there is a leak when the object is really destroyed afterwards.
--
Where are we going? And why am I in this handbasket?
|
|
|
|
|
So STL has global objects ? (besides cin,cout and cerr ). Because I don't have any global objects ( that's my concern - the fstream object is created on the stack , so it's destroyed before I call _CrtDumpMemoryLeaks) .
If it has, do you have any idea, are these objects thread safe ? And can you name some ?
|
|
|
|
|
I am a fairly new user to MS Visual C++ 6 and I have a couple of questions.
Is there a way that I can monitor the value in say an edit box in another Windows program and get the new value to do some kind of computation on it??
Another question is how would I go about sending inputs and outputs through an I/O board?? Is it possible as well to count the ticks of an encoder?
or would getting a value from a decoder on an I/O board be a better way, and how would I do this??
Any sample codes or help with codes would be GREATLY appreciated, but
any feedback will be helpful.
thanks
|
|
|
|
|
I'm sure the standard answer is "it all depends."
We interface in Win98 with hardware boards using "_inp" (in port) and "_outp" (out port) instructions, knowing what the port number is for the board. Those are directly callable from C++. Depending on the OS, you may not be able to get access at that level of hardware. WinNT "helps" us, by isolating us from that level of control with hardware.
Other devices may be "memory mapped" devices, where their control registers exist at an address, and then driver functions can be called to perform some action. That all depends on the board, of course. The I/O buffers may be memory mapped too, so getting data is a matter of accessing elements from an array, using a pointer initialized to the address of the I/O area.
Remember, too, that Windows is not "real time," and depending on your application, may not be suitable for really fast data I/O. Slow stuff is alright, but that will depend on your application.
Dave
|
|
|
|
|
I need a really simple data grid to put on a dialog to enter a 25x25 grid of integers, I have looked at CDataGrid, but I can't seem to enter data into it. I have also looked at Chris Maunder's MFC Grid control 2.23 but this seems a bit too complicated for my needs, and does far more than I require.
Any ideas
cheers andy
Andy
|
|
|
|
|
VC comes with several simple grids, none of which accept input. I believe this is by design, because the MSDN gives instructions on how to make them accept input ( basically create an edit control, put it over the grid, get the input, put it in the grid ), so I think the idea is that the input is only there if you decide to add it.
I dunno, but would a CListCtrl allow 25 columns ? It might be a much easier solution, and I don't see why it shouldn't, I just have never gone beyond 6 or so myself.
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
A (system wide) keyboard hook from another application crashes our Win16 application
Our app is built with VC++ 1.52, remember that?
Occurs (mostly) on Windows98 & ~SE.
Anyone seen problems like this before?
Even more importantly: Any ideas on how to avoid the crash from OUR app?
Or maybe narrow it down somewhat, to what actions in the hooking DLL could be causing this?
Thanks for any response/pointers/leads/etc.
Jorik.
|
|
|
|
|
I've downloaded a font and installed it on my machine.
I can use it easally in my MFC prj's by using CFont::CreateFont().
But... how can I assure that when I run my task on other machine the font
will be found and created properly, or In other words,
how can I add it to the resources and load it from there?
--BlackSimth--
"With the help of all mighty", 2001, Me.
|
|
|
|
|
I'm not so sure about if you can use a font "file" if it not is installed but if we say yes: Just add it like you add a simple bitmap as a resource. Right click the map in the tree view in VC++ and click "Import...". Then youst find the font and after that you'll be saked to write a resource type name: eg. Font. DONE!
But as I said before! I don't know if you can use uninstalled fonts...
------------------------------
©0d3 ©®4©k3® - That's me!
------------------------------
|
|
|
|
|
Ok, I give up. I am going to have to give in and ask for some help.
I am trying to change the colours of a bitmap (make it grayscale). I have got it working for 16, 24, and 32 bit bitmaps, but I am lost as to how to do this for 4 and 8 bit bitmaps
The HBITMAP passed into my function could be a DIB or a DDB
HBITMAP #####::GrayScale(CDC *pDC, HBITMAP hBitmap)
{
BITMAP bmp;
::GetObject(hBitmap, sizeof(BITMAP), &bmp);
if (bmp.bmBitsPixel < 16)
{
}
else
{
HBITMAP hDib = (HBITMAP)::CopyImage(hBitmap, IMAGE_BITMAP, 0, 0, LR_COPYRETURNORG | LR_CREATEDIBSECTION);
DIBSECTION DibSection;
::GetObject(hDib, sizeof(DIBSECTION), &DibSection);
int Size = DibSection.dsBmih.biWidth * DibSection.dsBmih.biHeight;
BITMAPINFO bmi;
bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bmi.bmiHeader.biHeight = bm.bmHeight;
bmi.bmiHeader.biWidth = bm.bmWidth;
bmi.bmiHeader.biPlanes = 1;
bmi.bmiHeader.biBitCount = bm.bmBitsPixel;
bmi.bmiHeader.biCompression = BI_RGB;
bmi.bmiHeader.biSizeImage = ((bm.bmWidth * bm.bmBitsPixel + 31) & (~31)) / 8 * bm.bmHeight;
bmi.bmiHeader.biXPelsPerMeter = 0;
bmi.bmiHeader.biYPelsPerMeter = 0;
bmi.bmiHeader.biClrUsed = 0;
bmi.bmiHeader.biClrImportant = 0;
BYTE *pBits;
::GetDIBits(pDC->m_hDC, hDib, 0, bm.bmHeight, pBits, &bmi, DIB_RGB_COLORS);
...
...
::SetDIBits(pDC->m_hDC, hDib, 0, bm.bmHeight, pBits, &bmi, DIB_RGB_COLORS);
return hDib;
}
}
It is my understanding that in 4 and 8 bit bitmaps, the bits returned by GetDIBits() are actually pointers into a colour table, and to change the image to grayscale I have to change the colour table. How do I get access to the colour table
I have tried
::GetDIBColorTable(memDC.m_hDC, 0, 1<<bmp.bmBitsPixel, rgbquad); For a 256 colour bitmap, ::GetDIBColorTable() returns 256, but the rgbquad array is full of garbage (every entry is 0xcc in debug mode). I have read Zafir Anjum's Drawing an image in grayscale but I could not get that to work the way i wanted either. I have tried several other things but nothing seems to work
I am probably missing something obvious and I hope some one can point out to me what it is.
---
It may be that your sole purpose in life is simply to serve as a warning to others.
|
|
|
|