|
Saadhinchaali wrote: I wonder how it does this?
How does it do what? I already explained how the two ends
are able to connect.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi Mark,
Thank you for your answer.
My doubt is when we generate a remote desktop connection request is generated from on system how the relay server knows, to which this connection request has to be sent?
Saadhinchaali
|
|
|
|
|
Some kind of connection has to be made at both ends.
It can be done peer-to-peer as well, but that can require network
settings. The old PCAnywhere did that.
I can only guess as I haven't used it, but I know it's not magic - there's
some kind of discovery going on...
Do you have a specific question about it? Internet connections pretty much all
work the same way - a listening "server" and an endpoint requesting a connection.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
hello,
it's kind of a newbie question, but i couldn't find it anyware so;
from an edit box i create a number if buttons, by pushing the "create" button.
that works without a problem.
now i want the button i just created to change colour or disapear when i click on it.
or i want an other button to disapear (ia with a textbox to filin witch one to disapear)
and that part just won work.
the number of buttons i want to create is unlimmited (1000 in this code).
what can i do?
#include <vcl.h>
#pragma hdrstop
using namespace std;
#include "Unit1.h"
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
TButton *Button[1000];
int count;
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
void __fastcall TForm1::Button1Click(TObject *Sender)
{
Button[count] = new TButton(this);
Button[count]->Parent=Form1;
Button[count]->Visible=true;
Button[count]->Top=(count*20)+10;
Button[count]->Left=10;
Button[count]->Caption= "Button "+IntToStr(count);
}
void __fastcall TForm1::Edit1Change(TObject *Sender)
{
count = StrToInt(Edit1->Text);
}
by the way, i'm using borland c++builder
wkr,
Willem
the final code wil be somthing like this:
ifstream SOSfile("config\\sos.cfg");
int ButtonCounter = 1 ;
while(NumberOfSource !=0)
{
getline(SOSfile,input);
SOButtonID = input.c_str();
getline(SOSfile,input);
SOLEFT = StrToInt(input.c_str());
getline(SOSfile,input);
SOTOP = StrToInt(input.c_str());
getline(SOSfile,input);
SOImage = input.c_str();
getline(SOSfile,input);
SOPAGE = StrToInt(input.c_str());
getline(SOSfile,input);
SOCaption = input.c_str();
getline(SOSfile,input);
SOSource = input.c_str();
getline(SOSfile,input);
SOSpare = input.c_str();
getline(SOSfile,input);
SOSpare = input.c_str();
getline(SOSfile,input);
SOSpare = input.c_str();
BitBtn[SOIDButton]=new TBitBtn(this);
BitBtn[SOIDButton]->Name= SOButtonID.c_str();
BitBtn[SOIDButton]->Visible=true;
BitBtn[SOIDButton]->Height = 57;
BitBtn[SOIDButton]->Width = 57;
BitBtn[SOIDButton]->Top=SOTOP;
BitBtn[SOIDButton]->Left= SOLEFT;
BitBtn[SOIDButton]->Bitmap->LoadFromFile(SOImage.c_str());
BitBtn[SOIDButton]->Caption = BitBtn[SOIDButton]->Name;
if(ButtonCounter <= 18){BitBtn[SOIDButton]->Parent = PanelSO1;}
if(ButtonCounter > 18 && ButtonCounter <= 36){BitBtn[SOIDButton]->Parent = PanelSO2;}
if(ButtonCounter > 36 && ButtonCounter <= 54){BitBtn[SOIDButton]->Parent = PanelSO3;}
if(ButtonCounter > 54 && ButtonCounter <= 64){BitBtn[SOIDButton]->Parent = PanelSO2;}
ButtonCounter = ButtonCounter + 1;
NumberOfSource = NumberOfSource - 1;
}
i just want these new created buttons to do something unique (read from the file)
|
|
|
|
|
wielklem wrote: or i want an other button to disapear (ia with a textbox to filin witch one to disapear)
and that part just won work.
Are you calling ShowWindow(hButton, SW_HIDE) ?
wielklem wrote: i just want these new created buttons to do something unique (read from the file)
Do you have code in place to respond to a button click?
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
<quote>
Are you calling ShowWindow(hButton, SW_HIDE)?
no, in cBuilder it's Button[idbutton]->visible = false; or colour = red ia
but the problem is the [idbutton] outside the creation void this id doesn't exist.
ia:
void blabla()
{
Button[test] = new TButton(this); \\ now i've got a button called Buttontest
}
void blabla2()
{
Buttontest->colour = red; // now it should change to red
}
instead of changing the colour to red the compiler shouts out "error, this Buttontest doesn't exist"
if i put the change colour into the creation void, than it doesn't change but becomes the defauld property of the button.
<quote>
Do you have code in place to respond to a button click?
that's the problem, i don't know how to do that [newbie]
|
|
|
|
|
wielklem wrote: no, in cBuilder...
Keep in mind that this is a Microsoft-centric forum, hence the VC++/MFC at the top.
wielklem wrote: that's the problem, i don't know how to do that [newbie]
And likely neither do we, unless you happen to find someone else that knows cBuilder.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
i know, but the basics are the same, it's still c++.
if i've got the code or the basic way to work in visual c, than i can translate it into cbuilder.
creating a new button or changing a code-written button is no problem.
so what i need is the basic way to give a new-made button a function or change it's behaviour / apearence.
|
|
|
|
|
wielklem wrote: i know, but the basics are the same, it's still c++.
Not really, but that's an altogether different discussion.
wielklem wrote: so what i need is the basic way to give a new-made button a function or change it's behaviour / apearence.
Check out ModifyStyle() and SetWindowLong() .
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Why so many questions, David? How is this guy supposed to get any work done when he has to spend half his day answering questions. At this rate, he'll never get around to using the debugger or reading any documentation.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Touche.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Excellent link!
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi
How to get text of menu item in CString.
how can get whole menu item data in MENUITEMINFO structure.
Thanks.
destined to win
|
|
|
|
|
[^], [^], [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi everyone,
I am programming an application which pretends to work under Xp and vista using getAdaptersAddresses function. This function returns code 13 everytime i call it(only in Vista). The following code already works under XP but fails in Vista. I would appreciate any help or tip. Thank you in advance.
{
PIP_ADAPTER_ADDRESSES adapterAddresses = NULL;
PIP_ADAPTER_ADDRESSES adapterAddress = NULL;
DWORD ret = 0;
ULONG len = 0;
len = sizeof (IP_ADAPTER_ADDRESSES);
adapterAddresses = (IP_ADAPTER_ADDRESSES*) malloc(len);
if (adapterAddresses == NULL) {
// Don't care about return value
return INADDR_ANY;
}
// Try to get the size. It is not modified under vista.....
if ((ret=GetAdaptersAddresses(AF_INET, GAA_FLAG_INCLUDE_PREFIX , NULL, adapterAddresses, &len)) == ERROR_BUFFER_OVERFLOW){
// This should happen....
MessageBox(NULL,L"RESERVING",L"LLL",MB_OK);
free(adapterAddresses);
adapterAddresses = (IP_ADAPTER_ADDRESSES*) malloc(len);
if (adapterAddresses == NULL){
return INADDR_ANY;
}
}
// Check return value.
switch(ret){
case NO_ERROR :MessageBox(NULL,L"AdapterAddress OK!!", L"Enter Interfaces", MB_OK);break;
case ERROR_ADDRESS_NOT_ASSOCIATED :MessageBox(NULL,L"AdapterAddress FAILED!!-NO ADDRESS ASSOCIATED", L"Enter Interfaces", MB_OK);break;
case ERROR_BUFFER_OVERFLOW :MessageBox(NULL,L"AdapterAddress FAILED!!-OVERFLOW", L"Enter Interfaces", MB_OK);break;
case ERROR_INVALID_PARAMETER :MessageBox(NULL,L"AdapterAddress FAILED!!- PARAMETERS", L"Enter Interfaces", MB_OK);break;
case ERROR_NOT_ENOUGH_MEMORY :MessageBox(NULL,L"AdapterAddress FAILED!!- NO MEMORY", L"Enter Interfaces", MB_OK);break;
case ERROR_NO_DATA :
MessageBox(NULL,L"AdapterAddress FAILED!!- NO DATA", L"Enter Interfaces", MB_OK);break;
default :
{
LPVOID MsgBuf;
if (FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
ret,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
(LPTSTR) &MsgBuf,
0,
NULL ))
MessageBox(NULL,(LPCWSTR)MsgBuf,L"ERROR ADAPTER 1",MB_OK);
WCHAR aux[100];
wsprintf(aux,L"Len %d - ret %d",len,ret);
MessageBox(NULL,aux,L"data",MB_OK);
}
break;
}
ret = GetAdaptersAddresses(AF_INET, GAA_FLAG_INCLUDE_PREFIX, NULL, adapterAddresses, &len);
// Check return value
switch(ret){
case NO_ERROR :MessageBox(NULL,L"AdapterAddress OK!!", L"Enter Interfaces", MB_OK);break;
case ERROR_ADDRESS_NOT_ASSOCIATED :MessageBox(NULL,L"AdapterAddress FAILED!!-NO ADDRESS ASSOCIATED", L"Enter Interfaces", MB_OK);break;
case ERROR_BUFFER_OVERFLOW :MessageBox(NULL,L"AdapterAddress FAILED!!-OVERFLOW", L"Enter Interfaces", MB_OK);break;
case ERROR_INVALID_PARAMETER :MessageBox(NULL,L"AdapterAddress FAILED!!- PARAMETERS", L"Enter Interfaces", MB_OK);break;
case ERROR_NOT_ENOUGH_MEMORY :MessageBox(NULL,L"AdapterAddress FAILED!!- NO MEMORY", L"Enter Interfaces", MB_OK);break;
case ERROR_NO_DATA :
MessageBox(NULL,L"AdapterAddress FAILED!!- NO DATA", L"Enter Interfaces", MB_OK);break;
default :
{
LPVOID MsgBuf;
// printf("Call to GetAdaptersAddresses failed.\n");
if (FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
ret,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
(LPTSTR) &MsgBuf,
0,
NULL ))
MessageBox(NULL,(LPCWSTR)MsgBuf,L"ERROR ADAPTER",MB_OK);
WCHAR aux[100];
wsprintf(aux,L"Len %d - ret %d",len,ret);
MessageBox(NULL,aux,L"data 2 ",MB_OK);
}
break;
}
// Function continues....
}
|
|
|
|
|
I have solved the issue. It is none related with the code but with iphlpapi.dll file. In windows vista this file is smaller for some reason, and using it instead of the one added by vs2008 (from windows xp) fixes this error.
|
|
|
|
|
Hector_M wrote: In windows vista this file is smaller for some reason, and using it instead of the one added by vs2008
The DLL comes with the operating system, not VS.
What gave you the idea you needed to redistribute it?
I hope you aren't doing that with other system DLLs.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Emmm, sorry there must be some errors in my answer. Of course i know that iphlpapi comes with the operative system, in fact is in windows/system32 directory, what i tried to say is that vs2008 included this file in my setup project, because it detects a dependency with it. So, when i installed my installation package in windows vista i discovered that iphlpapi was quite different from the one in winXP and cause my app to crash, what was amazing for me, since systems should be compatible backwards...although microsoft has its own rules.... .
The only doubt about that is the differences between those files, and i ask myself if the group of functions "GetAdapterInfo" has been removed definitely, and the problems with backwards compatibility.
Apart from that, thanks for answering.
Hector.
|
|
|
|
|
Hector_M wrote: vs2008 included this file in my setup project, because it detects a dependency with it.
Well that is redistributing it, isn't it? Does your
setup place it on the destinatioon machine? If so, that's
wrong, and it should be removed from your setup.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Emmm sorry once again, with "and using it instead of the one added by vs2008 (from windows xp) fixes this error" (on the first reply) i meant that i excluded it from my project, and let the OS look for its own iphlpapi.dll,but in any case, thanks a lot for your answers.
Hector
|
|
|
|
|
Hector_M wrote: ...and using it instead of the one added by vs2008 (from windows xp) fixes this error.
Or masks it.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Hallo
i used in my app to open a file by browsing open Dialog box. After that i want to
create a text file in my application directory using '..\\' notation. Like
fp = fopen("..\\MyApp\\Temp\\Something.txt","w");
Can it possible to create a file in my app directory using '..\\' this type of notation.
Thanks
|
|
|
|
|
Sk Mohiuddin wrote: After that i want to
create a text file in my application directory using '..\\' notation
Your notation depends on the current directory. How do you know where it points to at the moment?
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
Yes you can. But, as already pointed out by sashoalm, there must exist the folder MyApp\Temp inside the application current directory.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Thanks for the Suggestion
|
|
|
|
|