|
sstainba wrote: I can load it just fine as long as I include the header and use the int name
I read that and apparently ignored it If that works then it's definitely the name -
Open the resource.h file in the DLL project and remove any #define entry for IDB_BITMAP36.
Since you're using strings, it may be helpful to use more descriptive names - there's no reason to
use the naming conventions that are assigned by the Visual Studio editing environment.
"I'm the Dude. So that's what you call me. You know, that or, uh, His Dudeness, or uh, Duder, or El Duderino if you're not into the whole brevity thing." The Big Lebowski
|
|
|
|
|
YAY!!!!! It worked. You rock. Hahaha... I tried asking this questiong on CodeGuru and this one guy was acting like I was an idiot for even thinking such a thing could be done. He said that the resource name wasn't stored in the dll file (WTF?). Anyway, thanks a lot!
PS. I don't suppose you know how to get a CToolTipCtrl to work do you? I followed the MSDN but it never shows up...
|
|
|
|
|
sstainba wrote: I tried asking this questiong on CodeGuru and this one guy was acting like I was an idiot for even thinking such a thing could be done.
Yeah - I was pretty much called stupid for asking a question on the Microsoft boards the
first time I went there. Geez, if you're tired of answering "stupid" questions then don't answer!
I personally believe the only stupid question is one that isn't asked (I don't know where I heard
that....maybe read it on a Starbucks cup or something )
sstainba wrote: He said that the resource name wasn't stored in the dll file (WTF?).
I wonder how he thought resources were located
sstainba wrote: PS. I don't suppose you know how to get a CToolTipCtrl to work do you? I followed the MSDN but it never shows up...
For a dialog window, right? I'll steal an example right from the MFC sample code:
ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTW, 0, 0xFFFF, OnToolTipNotify)
ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTA, 0, 0xFFFF, OnToolTipNotify)
...
EnableToolTips(TRUE);
...
afx_msg BOOL OnToolTipNotify(UINT id, NMHDR * pNotifyStruct, LRESULT * result);
...
BOOL CMyDlg::OnToolTipNotify(UINT id, NMHDR *pNMHDR, LRESULT *pResult)
{
TOOLTIPTEXTA* pTTTA = (TOOLTIPTEXTA*)pNMHDR;
TOOLTIPTEXTW* pTTTW = (TOOLTIPTEXTW*)pNMHDR;
CStringA strTipText;
UINT nID = pNMHDR->idFrom;
if (pNMHDR->code == TTN_NEEDTEXTA && (pTTTA->uFlags & TTF_IDISHWND) ||
pNMHDR->code == TTN_NEEDTEXTW && (pTTTW->uFlags & TTF_IDISHWND))
{
nID = ::GetDlgCtrlID((HWND)nID);
}
if (nID != 0)
strTipText.Format("Control ID = %d", nID);
if (pNMHDR->code == TTN_NEEDTEXTA)
strncpy(pTTTA->szText, strTipText, sizeof(pTTTA->szText));
else
::MultiByteToWideChar( CP_ACP , 0, strTipText, -1, pTTTW->szText, sizeof(pTTTW->szText) );
*pResult = 0;
return TRUE;
}
Note that this just shows a normal tooltip with text "Control ID = xxxx". You'd probably want to
map the control ID to a meaningful string.
Cheers
Mark
"I'm the Dude. So that's what you call me. You know, that or, uh, His Dudeness, or uh, Duder, or El Duderino if you're not into the whole brevity thing." The Big Lebowski
|
|
|
|
|
I forgot to mention....
if you choose to implement tooltips like that sample code, the strings you use can be loaded
from a stringtable resource, and the stringtable can be in your resource DLL.
The TOOLTIPTEXT structs have a hinst member to specify the HINSTANCE of the DLL.
If you choose to use stringtable resources for the strings, then lpszText should be set to the
ID of the string resource and the hinst member set to the instance of the module (EXE or DLL)
that contains the resource, something like:
// get string 32777 from this EXE's resources
pTTTW->hinst = ::GetModuleHandle(0);
pTTTW->lpszText = (LPWSTR)32777;
Mark
"I'm the Dude. So that's what you call me. You know, that or, uh, His Dudeness, or uh, Duder, or El Duderino if you're not into the whole brevity thing." The Big Lebowski
|
|
|
|
|
Actually, I got it working. Used a CToolTipCtrl. haha. Thanks for the info anyway.
|
|
|
|
|
Cool!
"I'm the Dude. So that's what you call me. You know, that or, uh, His Dudeness, or uh, Duder, or El Duderino if you're not into the whole brevity thing." The Big Lebowski
|
|
|
|
|
Hi I am currently using servel pins (CTS and RTS) of my serial port for data transfer with a program I wrote in Visual C++ 2005 under Windows XP.
I would like to write a program to send data over the unused pins.
Is it possible to write to individual pins (independently) using Visual C++? How is this done because I am stumped?
|
|
|
|
|
I am a newby so forgive me if I have misunderstood your question and this answer is no help at all.
I just wrote an app that uses pins individually on the serial port. and the code looks like this.
HANDLE hCom;
DCB dcb;
//Create the handle for the comport.
hCom = CreateFileA("COM1", GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL );
if(hCom == INVALID_HANDLE_VALUE)
{
CloseHandle(hCom);
MessageBox("There are no ports avaiable. You may neeed to configure a port");
}
// Get the state of the comport and fills the dcb structure.
GetCommState(hCom, &dcb);
//You can use the following to set pins how you like.
dcb.fRtsControl = RTS_CONTROL_DISABLE; // These are outputs can be set either high or low.
dcb.fDtrControl = DTR_CONTROL_DISABLE;
// Sets the port.
SetCommState(hCom, &dcb);
I hope this helps. If not sorry to waiste your time.
I believe you would have to use WriteFile(); to send real data.
|
|
|
|
|
Hi all, im trying to do the following:
Print a string of chars to a buffer, and print from the buffer using the sockets send() function. So far i havnt found a way.
The function in question:
<br />
bool TextSender(const char* Text)<br />
{<br />
if(send(dataSock, Text, strlen(Text), 0) == -1)<br />
return false;<br />
else<br />
return true;<br />
}<br />
I was wondering if i printed information to either dataSock or Text it would work, but it does nothing.
Does it matter if i define char Text; at the top ? Because its not doing a thing, any suggestions? Thanx in advance!
|
|
|
|
|
So if send() is failing, why are you not calling WSAGetLastError() to figure out why?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Can you give me an example DavidCrow on how to call it properly please? Thanx.
|
|
|
|
|
bool TextSender( const char* Text )
{
if (send(dataSock, Text, strlen(Text), 0) == SOCKET_ERROR)
{
DWORD dwError = WSAGetLastError();
return false;
}
else
return true;
}
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
in hash tables every index in the table refers to a linked list which have slots, each slot have key, data, next, how to insert the data from a text file or html file that we have as every data in each slot is a certain line in the file (text or html), & the key is the no. of that line.
|
|
|
|
|
Hi,
I come from a MainFrame Background I haven't gotten into the OO way of thinking
My application which I have created a class for, for Argument sake I'll call MyClass
could use help from 2 other classes (one to check if something is a valid Hex sting and another if it is to convert that string to a Hex number
)
my question is how would I code that
Class MyClass : public Classa : public Classb
{
if so which is the base and which is derived ?
Do I have to worry about the constructers of all 3 ??
and can myClass get at the protected members of classb and CLassa
Thank ahead of time
to all you C++ experts
Which I hope to become one day
|
|
|
|
|
In OO programming I think in terms of "is a" and "has a". "is a" means it IS a class while
"has a" refers to something that should be a member of a class.
While your method will work, it does't necessarily make sense.
To make it more clear, I'll give your classes appropriate names:
class ValidHexStringChecker;
class StringToHexConverter;
Class MyClass : public ValidHexStringChecker, public StringToHexConverter
{
};
ValidHexStringChecker and StringToHexConverter are base classes.
MyClass is a derived class, derived from both base classes.
MyClass IS A ValidHexStringChecker and it also IS A StringToHexConverter.
Unless MyClass encapsulates a string, it doesn't make sense for it to be a converter and checker.
It could HAVE ("has a") methods to do those operations but to actually BE an object that does
those doesn't make sense.
Using "is a/has a", I'd ask myself - IS Myclass a ValidHexStringChecker/StringToHexConverter?
If not, then revert to "has a", and add methods to do those operations, something like:
Class MyClass
{
public: //or protected or private
bool CheckValidHexString(...);
bool ConvertStringToHex(...);
};
ForNow wrote: Do I have to worry about the constructers of all 3 ??
If the base classes need construction with constructors that take passed parameters, then yes.
If the base classes have default constructors, and that's the only constructor needed, then no.
ForNow wrote: and can myClass get at the protected members of classb and CLassa
Yes, because you've specified public access to the base classes (see Controlling Access to
Class Members[^]).
I hope at least a little of that made sense
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
While OO is neat and useful, don't let it over-complicate things (e.g., not everything has to be a class just because C++ is being used). Unless you can actually think of your "something" as an object (which you probably could), why not just make "is a valid Hex sting" and "convert that string to a Hex" into just plain functions? The former could easily be done with strtol() .
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I was thinking - atoi - However I really realy want to learn C++
If you have any suggestions please let me know
thankx
|
|
|
|
|
ForNow wrote: I was thinking - atoi...
Well don't, since it will not work with base-16 numbers.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
|
Hello,
It is probably a very bad question I post but why not trying.
Actually I use a CListCtrl with Edit label mode set to true and I would like to input from within a row a member variable name or an object member name instead of inputting a value.
This variable name or object name will be passed as argument to a function.
Is there a simple solution to do it?
Thnks for your kind help.
|
|
|
|
|
You want to be able to type in a variable name in the edit box?
If so, you'll need to write code (maybe in response to LVN_ENDLABELEDIT) to map the entered text
to a variable in your code.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Mark,
Thnks for your help.
yes I want to type in a variable name in the edit box.
could you please be more explicit about mapping the entered text?
Do you mean that I must store the variable name and a string of a same name as the variable in a CMap or std::map and to compare the entered text with the string in the map?
If the string is found I then get the variable related to the string?
|
|
|
|
|
Sure, you could use a map. If there was only a few possibilities you could even use
if/else if/else if you wanted to
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Hi All
i want to get Unique Id of a particular device connected through USB \FIRWIRE Port.
IS Serial number unique? so how will i find find it of a device (like digital camera,scanner etc.)
i am able to get serial number of storage device(like USB flash Key, eternal Hard disk).
With Regards
RYK
|
|
|
|
|
I have this UI issue causing my application to hang and I am absolutely clueless what is causing the hang.
From the callstack I find that it waits at ntdll, using SPY++ I find no messages being recieved by the application. It is also not a crash as the frame messages are being recieved but the opened document is frozen.
Any clues about how to approach the problem??
|
|
|
|
|