|
I'm designing a custom control based on the CWnd class that displays a card
for a card game. I have been able to get the control to send back messages
to the parent dialog (MFC Dialog App) but I have had no end of trouble trying
to figure out which card has been clicked when they are overlapped. I've
tried messing around with the z-order, but have had no success. Any ideas?
|
|
|
|
|
Hello, I'm trying to construct a 3D image using OpenGL by getting the coordinates from a series of bitmap files. Each bitmap contains a cross section of the shape at a different height. So I need to get 2D coordinates from the files to construct my image. How do I get coordinates from a bitmap picture, supposing that I have marked all the necessary coordinates with red dots in the bitmap files. (note: there is no red in the bitmap otherwise).
|
|
|
|
|
The powers that be have dropped a Grand Multi Capture Card on my desk. It has four ports that CCTV cameras my be plugged into. Using AVICAP I can capture from one camera at a time. By calling up the source dialog box, I can select which camera is captured from.
What I would like to do is programatically select which camera is captured from. As far as I've managed to figure out, AVICAP can't do this, however I've heard a rumour about something called "crosspoint matrix" in DirectX.
Has anyone heard of this, or know of how I can do this please? Thanks
Jeremy Davis
http://www.astad.org
|
|
|
|
|
I want to find out the colour of every pixel in my bitmap.
GetPixel seems to be very slow
Can anybody help or point me to a certain docs?
Thank you in advance...
|
|
|
|
|
If memory serves me correctly, theres a bmbits pointer in the BITMAP structure. This might help. dont quote me onit though. arggh i cant type today
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
hi all
i am able to get the ip address of local host using gethostname() and gethostbyname() functions. but it is not working in Windows 95. it says WSAHOST_NOT_FOUND.
if i given value of hostname in gethostbyname function as Win95 m/c's name and i run it in Win98, its fetching the IP address perfectly(Win95 m/c ip address).
i don't know why its not fetching in Win95?
these system are all DHCP configured.
please get me if u have any idea
Thanks in advance.
regards
Halid
|
|
|
|
|
(Just a guess) Have you previously initialized Winsock with WSAStartup ?
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
hi,
i initialized Winsock by using WSAStartup function.
i am able to get the IP address in 98/NT systems. but its not woking in Win95.
i don't know the problem why its not working in Win95.
any suggestions.
regards
Halid
|
|
|
|
|
Well, you can pass NULL to gethostbyname if it's the local machine IP what you're after, but that would only mask your problem.
What version of Winsock are you using? If it is 2.0, how did you do the upgrade? (95 comes with 1.1 by default)
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
hi
this is my code to fetch the ip address of local host.
CString hname, IPAddress;
IPAddress.Empty();
WSADATA WSAData;
if(WSAStartup(MAKEWORD(1,1), &WSAData) != 0)
{
// MessageBox("Sockets unInitialized ","Server Sockets", MB_OK);
return ;
}
char hostname[250];
/* SOCKADDR_IN sin;
sin.sin_family = AF_INET;
sin.sin_port = 5000;*/
memset(hostname,'\0',sizeof(hostname));
if( gethostname(hostname,sizeof(hostname)) == SOCKET_ERROR)
{
// MessageBox(" Error getting host name","Server Sockets", MB_OK);
return ;
}
AfxMessageBox(hostname);
PHOSTENT phe;
phe = gethostbyname(hostname);
CString s;
struct in_addr *inaddr;
// AfxMessageBox(phe->h_name );
inaddr = (struct in_addr *)phe->h_addr_list[0];
int a = inaddr->S_un.S_un_b.s_b1;
int b = inaddr->S_un.S_un_b.s_b2;
int c = inaddr->S_un.S_un_b.s_b3;
int d = inaddr->S_un.S_un_b.s_b4;
IPAddress.Format("%d.%d.%d.%d",a,b,c,d);
AfxMessageBox(IPAddress);
}
how do i upgrade Winsock 1.1 to Winsock 2.0.
i'll try with hostname as NULL.
Thanks for your suggestion.
but reply me if you find any other method
regards
Halid
|
|
|
|
|
Your code seems OK to me (I compiled and ran it in a 95 box without problems).
I'd say probably your network settings are misconfigured, or it could be a problem with DHCP. I suggest to try the following tests:- Record the name returned by
gethostname and issue a ping to that name from the command line. It it fails then something's be wrong with your network settings.
- Run
winipcfg from the command line and check that your machine has been given an IP from the DHCP server. If it is not, then that could be the cause of the problem: in that case, try clicking on "Renew all" and running your program again. - Just for testing purposes, disable momentarily DHCP on your 95 machine and assign it some fixed IP instead. Run your program to see what happens.
You can follow this link to Windows Socket 2 Update for Windows 95. I don't think your problem will solve with the upgrade, though.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Thanks for your suggestion.
i have tried out all the options what you mentioned in message. In winipcfg, it shows the full details of that machine, including IP,DHCP server IP,MAC address and etc.,
if i run this code in 98/NT machine with hostname as Win95 machine's name, it shows the IP address of Win95 machine perfectly.
In gethostbyname function, i given "www.google.com" it shows the IP address of Google webserver, i ran this it in Win98. the same code is not running in Win95.
for all the values it says "WSAHOST_NOT_FOUND" error. i have passed NULL value in gethostbyname, still its giving this error only.
Pls, i need help from u.
regards
Halid
|
|
|
|
|
I cannot think of much more to do...
You might want to prepare a complete project for downloading and post the link here so that people can take a look at it and determine what's going wrong.
Also, have you tried running your program on a different 95 machine?
Sorry I couldn't be of more help.
Regards,
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
hi
Thanks for your suggestion.
i got one source code for fetching NIC informations using SNMP.
i tested that exe in Win95 its reading IP addresses and other informations perfectly.
once again thanks for your suggestion.
pls, give your mail id, so that i can contact if i have any problems.
regards
Halid
|
|
|
|
|
Hi,
I have mapped a few button clicks to the same function... Something like this:
ON_BN_CLICKED(IDC_BUTTON1, OnAnyButtonClick)
ON_BN_CLICKED(IDC_BUTTON2, OnAnyButtonClick)
ON_BN_CLICKED(IDC_BUTTON3, OnAnyButtonClick)
..... and so on.
In the function OnAnyButtonClick(), how do I know which button was clicked? How to find the ID of the button which caused this msg, inside this function?
Do I need to trap this in PreTranslateMessage instead? Which pMsg member hold the event (message BN_CLICKED) information, and which one holds the ID of the control which caused this notification?
Thankx for the help.
-Dave
|
|
|
|
|
Use the command range macro.
ON_COMMAND_RANGE(IDC_BUTTON1, IDC_BUTTON3, OnAnyButtonClick)
OnAnyButtonClick will then take the ID as a parameter.
void CYourClass::OnAnyButtonClick(UINT nID)
{
blahblah();
}
Cheers,
/Fredrik
Sonork ID: 100.11430:PhatBoy
|
|
|
|
|
Maybe this will help:
1. Add "Notify" style to your button of interest.
2. In Function "WindowProc" of your dialog (the parent of the button of above), add the following coding:
int ControlID;
int NotificationMessage;
if ( message == WM_COMMAND )
{
ControlID = LOWORD(wParam);
NotificationMessage = HIWORD(wParam);
if ( ControlID == IDC_BUTTON1
&& NotificationMessage == BN_CLICKED )
m_buttonPressed = 1;
// you may use this variable in your OnAnyButtonClick(),
// it indicates which button is pressed.
}
return CDialog::WindowProc(message, wParam, lParam);
|
|
|
|
|
I have several icons defined in resource part of my exe file. When the system paints the icon in the directory folder or elsewhere, it is obviously one of those it has found in the exe's resources.
Now the question.
How the system decides what icon to display, if I have many of them. I think it displays the first one found in the resource section of exe, but I am not sure. If this is true, how can I determine what icon should be the first. I noticed, that Visual C++ resource editor sorts the icon identifiers alphabetically to make the order (it does so for every type of resource). That order is also kept in the exe file, I think, but I have no control over this process. Except perhaps of stupid making identifier names to keep certain order. Could anyone clarify this for me?
|
|
|
|
|
golem wrote:
Visual C++ resource editor sorts the icon identifiers alphabetically to make the order (it does so for every type of resource). That order is also kept in the exe file
It does not even depend on the alphabetical order of identifiers as I thought. I had to change ID values in resource.h manually. The smallest value of icon ID made the icon to be main of the program.
But I don't like this approach and everyone knows that manual rewritting of resource.h is debatable.
|
|
|
|
|
golem wrote:
But I don't like this approach and everyone knows that manual rewritting of resource.h is debatable.
I manually renumber my resource.h all the time, why don't you like doing this?
Michael
|
|
|
|
|
Petzold book says that it is unwise. Am I to second him or you?
|
|
|
|
|
Hi there...
I have a dialog based application, which is always on top (HWND_TOPMOST). I have fixed the position of the dialog box to the bottom portion of the screen.
# Now, as soon as the dialog is displayed, I would like to resize the height of all the other already running applications windows, with in the space above my dialog window. Can u tell me how to do this? How do I get the other window handles?
# Also, is there a way to control the positioning of applications that could be spawned in the future? What I want is to reserve one fourth portion of the screen, when my application is running, as I dont want portions of other apps to go beneath my dialog(which is always on top).
Thankx in advance.
-Dave
|
|
|
|
|
I think you'd be better off, making your dialog an app-bar. Similar to the office short cut bar
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
..and how do I do that? Any material in this forum which can put some light on the how-to-do part of it?
Also, if decide to make it a app-bar, will it have all the properties that I desire?
Thankx again Nish..
-Dave.
|
|
|
|
|
Look up this function :- SHAppBarMessage
Regards
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|