|
getting linking error for a class which implements IMPLEMENT_RUNTIMECLASS_T macro.
|
|
|
|
|
Well unfortunately, we cannot see your screen, so have no idea what the error or its solution might be.
Use the best guess
|
|
|
|
|
- I've created a CPngButton from CBitmapButton.
- It overrides DrawItem() and draws the given PNG image using GDI+.
- The wm_erasebkgnd and wm_ctlcolor is taken care.
- while displaing the CMainFrame its displaying properly.
- Later if we resize the window couple of times, the transparent portions of button becomes black.
- OS is Windows 7 with Aero enabled.
- Screenshot is here[^]
- Any idea what I'm missing here?
(Some more information: The buttons are hosted on a CWnd as container. This CWnd is placed over left of menubar to looks like a quick access toolbar, which is a requirement).
Best Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
hi all,
I am using
static char alphabet[] =
"abcdefghijklmnopqrstuvwxyz"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"0123456789";
static int alphabet_size = sizeof(alphabet) - 1;
CString str_val=_T("");
void brute_impl(char * str, int index, int max_depth)
{
int i;
for (i = 0; i < alphabet_size; ++i)
{
str[index] = alphabet[i];
if (index == max_depth - 1)
{
str_val.Format("%s", str);
}
else
{
brute_impl(str, index + 1, max_depth);
}
}
}
void brute_sequential(int max_len)
{
char * buf = new char[max_len + 1];
int i=0;
while(buf[i] != NULL)
{
if(i==max_len+1)
break;
buf[i]='\0';
i++;
}
CString str=_T("");
str.Format("size of array is %d\n", i);
for (i = 1; i <= max_len; ++i)
{
memset(buf, 0, max_len + 1);
brute_impl(buf, 0, i);
}
free(buf);
}
but its time consuming and very slow
anybody have more efficient and fast method for this.
thanks.
|
|
|
|
|
Use a passwords list; you can find them freely on the web.
|
|
|
|
|
hi guys recently i started to work with open gl in dev c++ 4.9.9.2. I downloaded the glut package and all the dlls and object files. After installing it i tried a sample program. But i got lot of linker errors and it didnt run eventhough my syntax was correct. Anybody please help
|
|
|
|
|
adding only header (*.h) is not enough. You have to also add proper lib or cpp to your program in order to linker could see definitions of functions you are using in your program.
To add lib, see the linker options, there has to be some place to include additional libraries.
|
|
|
|
|
Hello,
I've just started to programm in C++, using Builder C++. I need to stablish comunication via internet between two computers. I've succed using the ClientSocket Component and the ClientServer but only if the computers are in a local network but not if the computers are in different networks. Here is my code for the server:
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
void __fastcall TForm1::BAbrirClick(TObject *Sender)
{
ServerSocket1->Port=StrToInt(Npuerto->Text);
ServerSocket1->Open();
BAbrir->Enabled=false;
BCerrar->Enabled=true;
BEstado->SimpleText="Servidor Conectado!";
NOnline->Text=IntToStr(ServerSocket1->Socket->ActiveConnections);
BEnviar->Enabled = true;
}
void __fastcall TForm1::BCerrarClick(TObject *Sender)
{
ServerSocket1->Close();
BAbrir->Enabled=true;
BCerrar->Enabled=false;
BEstado->SimpleText="Servidor Cerrado!";
NOnline->Text=IntToStr(ServerSocket1->Socket->ActiveConnections);
BEnviar->Enabled = false;
}
void __fastcall TForm1::ServerSocket1ClientConnect(TObject *Sender,
TCustomWinSocket *Socket)
{
BEstado->SimpleText="Conectado desde "+Socket->RemoteAddress;
NOnline->Text=IntToStr(ServerSocket1->Socket->ActiveConnections);
}
void __fastcall TForm1::ServerSocket1ClientDisconnect(TObject *Sender,
TCustomWinSocket *Socket)
{
NOnline->Text=IntToStr(ServerSocket1->Socket->ActiveConnections-1);
BEstado->SimpleText="Desconectado de "+Socket->RemoteAddress;
}
void __fastcall TForm1::ServerSocket1ClientRead(TObject *Sender,
TCustomWinSocket *Socket)
{
char * buffer;
int len;
AnsiString Mensaje;
int i;
int *tam;
tam = new int;
*tam = Socket->ReceiveLength();
len=Socket->ReceiveBuf(buffer,*tam);
buffer[len]=0;
TTime hora = TTime::CurrentTime();
AnsiString MensajeIn = Socket->RemoteAddress;
MensajeIn += " A las " + TimeToStr(hora) + " Dice" "----->";
ChatBox->Lines->Add(MensajeIn +StrPas(buffer));
BEstado->SimpleText=IntToStr(len)+"Nuevo mensaje entrante!";
Mensaje = StrPas(buffer);
strcpy(buffer,Mensaje.c_str());
for(i=0;i<ServerSocket1->Socket->ActiveConnections;i++)
ServerSocket1->Socket->Connections[i]->SendBuf(buffer,strlen(buffer));
delete[] buffer;
}
void __fastcall TForm1::BEnviarClick(TObject *Sender)
{
char buffer[256];
int i;
AnsiString Mensaje = CampoMensaje->Text;
strcpy(buffer,Mensaje.c_str());
for(i=0;i<ServerSocket1->Socket->ActiveConnections;i++)
ServerSocket1->Socket->Connections[i]->SendBuf(buffer,strlen(buffer));
TTime hora = TTime::CurrentTime();
ChatBox->Lines->Add("Servidor a las " +TimeToStr(hora)
+ " dice----->" + Mensaje);
}
void __fastcall TForm1::LimpiarClick(TObject *Sender)
{
ChatBox->Clear();
}
void __fastcall TForm1::CampoMensajeKeyUp(TObject *Sender, WORD &Key,
TShiftState Shift)
{
if (Key == 13)
TForm1::BEnviarClick(CampoMensaje);
}
void __fastcall TForm1::NpuertoKeyUp(TObject *Sender, WORD &Key,
TShiftState Shift)
{
if (Key == 13)
TForm1::BAbrirClick(Npuerto);
}
void __fastcall TForm1::TcpServer1Accept(TObject *Sender,
TCustomIpClient *ClientSocket)
{
TcpServer1->RemotePort = StrToInt(Npuerto->Text);
TcpServer1->Open();
BAbrir->Enabled=false;
BCerrar->Enabled=true;
BEstado->SimpleText="Servidor Conectado!";
NOnline->Text=IntToStr(ServerSocket1->Socket->ActiveConnections);
BEnviar->Enabled = true;
}
void __fastcall TForm1::TcpServer1CreateHandle(TObject *Sender)
{
NOnline->Text=IntToStr(TcpServer1->Active-1);
BEstado->SimpleText="Desconectado de "+TcpServer1->LocalHostName();
}
How can I implement comunication (a simple chat is enough) between the two computers?
|
|
|
|
|
It is exactly the same, you just need to configure your firewalls to allow access between the two systems.
Use the best guess
|
|
|
|
|
AntonioJesus wrote: computers are in different networks
Hola Senor - I think anyone reading this would need to know how your network was set up and what exactely you mean by 'different networks' .. for example, you could mean in two different subnets/zones, or talking over the internet
In both cases, its likely your code doesnt need any change, but your networks may need routes, firewall rules etc
'g'
|
|
|
|
|
With different Newtworks I mean over the internet. Both computers are conected to internet via wi-fi both running windows.
|
|
|
|
|
As already said by others: This is not a problem of your code, but of the network topology.
The IP adress of the server must be routable (adress can be reached by the client). If the server is behind a router that connects a local network using private adresses to the internet (or another local network with a different private IP range), you must setup port forwarding on the router. If there is a firewall involved, it must be also configured to allow passing packets from/to the forwarded ports and the server IP. When internet access on the server side uses dynamic IPs (common with dial-up connectings), you must also register a dynamic DNS name and configure this in the router.
This setup is not required for clients because routers on the client side will usually perform the forwarding. But when using non-standard ports, it may be also necessary to allow these ports in firewalls and routers.
The keywords to read more about this topic are NAT (Network Address Translation), Port Forwarding, and DDNS (Dynamic DNS).
When using a private internet access, see the manual of your router to configure port forwarding and DDNS. Otherwise ask the network administrator of your company / educational institution.
|
|
|
|
|
One of the benefits of the OSI model is that applications (level 7) rarely ever have to change when the underlying hardware/protocol (layers 1-3) changes.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
Hey all,
I'm not sure if this is the right place for this kind of discussion but I’ll ask anyways. I’ve been working on embedded systems for a while, mainly in C. I’d like to do more with C++/.Net (or other OOP languages/frameworks etc..) but I don’t know where to start in terms of a non-embedded project. My question is; does anyone have an idea for a project or perhaps worked on something that was useful and more challenging than text book style projects (ie something more “real world” that I can use to gain OOP experience in my own time). Any thoughts would be appreciated.
|
|
|
|
|
Basically, it doesn't matter what you code, you can always choose to approach it from an OOP perspective. So, then it's just the question of what you want to create.
I often create (small) tools, math-gimmicks like prime-number searches, and 'technical test projects' (to test out a specific API/environment/library for the purpose of learning).
Others are more inclined to program games, or simulations, for instance.
I think a pitfall in this case with creating a program in C++ is that it's all too tempting to use what you know in C and do it like that (though you'll have to consider for yourself if that applies).
As soon as you have something you want to create, start thinking about the involved objects and their lifetime. Start simple, for your first project, and limit the complexity and amount of classes. Most of OOP is about dividing functionality and responsibility among classes and determining their lifetime, and modelling the interactions between them. A good strategy is to make each class responsible for exactly one thing and to use a 'black box' principle: other code/classes should only concern themselves with what the class does for them, and not 'how' it does it. A rule of the thumb related to this is that if you start writing code in class1 like class2->memberClass->someMethod() that something is wrong, because now class1 needs to know the rules of class2::memberClass, which violates that black box principle. Of course, this is only a guideline and not necessarily is wrong.
Good luck
|
|
|
|
|
|
Pick up Visual Studio and play around writing MFC apps. It will give you a nice into to classes, OO, UI design, and you can knock up some interesting apps.
I use MFC a lot writing test programs for my Windows drivers and is an excellent technology.
==============================
Nothing to say.
|
|
|
|
|
static int pstate_param_set(char *val, int kp)
{
return 0;
}
static int pstate_param_get(char *buffer, int kp)
{
return 0;
}
struct mystruct
{
int (*set)(char *val, int kp);
int (*get)(char *buffer, int kp);
};
static struct mystruct jober = {
.set = pstate_param_set,
.get = pstate_param_get
};
==============================
Nothing to say.
|
|
|
|
|
|
Error . then two missing ; errors
==============================
Nothing to say.
|
|
|
|
|
Good link!
I have been wandering around the net trying to find the answer. SO it seems it is a C only method of struct func pointer initialisation. Interesting.
==============================
Nothing to say.
|
|
|
|
|
Nah, doesnt work as C code with VS either.
error C2059: syntax error : '.'
And it is C code, I checked by declaring a variable after a func, it gulched at that, so it is deffinitely seeing it as C code.
==============================
Nothing to say.
|
|
|
|
|
|
Exactly: it still does not.
Veni, vidi, vici.
|
|
|
|
|
Cheers Chris, I thought that was the case.
==============================
Nothing to say.
|
|
|
|