|
A recent rev to the C spec allows this - search for __VA_ARGS__ - but AFAIK this hasn't made it into C++ yet.
You can make an alias for a namespace, though:
namespace foo = ReallyLongHardToTypeName;
--Mike--
Visual C++ MVP
LINKS~! Ericahist | NEW!! PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
|
|
|
|
|
I have a static control(derived from CStatic) and it contains two lines. I want to set the color of the first line to blue and the second line to red. Currently I am using the CDialog::OnCtlColor and using the SetTextColor function to set the color. However it sets the color for the whole static control i.e. both the lines. Can someone help?
|
|
|
|
|
The OnCtlColor message doesn't give you that amount of control over the text lines that gets coloured.
In cases like that where you need very flexable colour control, you might as well use the rich edit control, or search for one the various HTML-CStatic hybrids that are available on this site.
I Dream of Absolute Zero
|
|
|
|
|
LeeeNN wrote: Currently I am using the CDialog::OnCtlColor and using the SetTextColor function to set the color. However it sets the color for the whole static control i.e. both the lines. Can someone help?
Try this Control http://www.codeproject.com/staticctrl/pphtmlstatic.asp[^]
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Im want to do some messaging through an RS232, but dont know where to start really... Does anyone have any good examples or know where to find them using an RS232 Connection?
"There are 10 types of people, those who understand binary, and those who don't."
- Somebody, not me.
|
|
|
|
|
|
Thanks a ton, very helpful...
-Jason
"There are 10 types of people, those who understand binary, and those who don't."
- Somebody, not me.
|
|
|
|
|
Is there a function in Win32/MFC that will determine if a file name is valid?
I'm looking for something that tests for the conditions mentioned in this article under the Naming Conventions heading.
"My dog worries about the economy. Alpo is up to 99 cents a can. That's almost seven dollars in dog money" - Wacky humour found in a business magazine
|
|
|
|
|
There are probably lots of ways, but try this:
IMoniker* pMonk;
HRESULT hr = CreateFileMoniker(OLESTR("C:\\auxa.txt"), &pMonk);
if ( SUCCEEDED(hr) )
{
pMonk->Release();
}
Be sure you've called OleInitialize , CoInitialize or CoInitializeEx somewhere in your process.
Steve
|
|
|
|
|
Doesn't work. (they're all valid)
I went through a slew of file based functions, including things like GetShortFileName, hoping for a failure if the name was invalid, none worked.
I guess I'll just use a regular expression.
"My dog worries about the economy. Alpo is up to 99 cents a can. That's almost seven dollars in dog money" - Wacky humour found in a business magazine
|
|
|
|
|
I used the following code:
--------------------------
void IsValid(LPCOLESTR pFileName)
{
IMoniker* pMonk;
HRESULT hr = CreateFileMoniker(pFileName, &pMonk);
if ( SUCCEEDED(hr) )
{
pMonk->Release();
wcout << L"'" << pFileName << L"' is valid.\n";
return;
}
wcout << L"'" << pFileName << L"' is NOT valid.\n";
}
int main(int argc, char* argv[])
{
OleInitialize(NULL);
IsValid(OLESTR("auxa.txt"));
IsValid(OLESTR("aux.txt"));
IsValid(OLESTR("aux .txt"));
IsValid(OLESTR("C:\\ filename.txt"));
IsValid(OLESTR("C:\\auxa.txt"));
IsValid(OLESTR("C:\\aux.txt"));
IsValid(OLESTR("C:\\aux .txt"));
OleUninitialize();
return 0;
}
And got this in output:
-----------------------
'auxa.txt' is valid.
'aux.txt' is valid.
'aux .txt' is valid.
'C:\filename.txt ' is valid.
'C:\auxa.txt' is valid.
'C:\aux.txt' is NOT valid.
'C:\aux .txt' is NOT valid.
Seems to work only for fully qualifed paths. Seems to fail the trailing space rule in any case.
Steve
|
|
|
|
|
I don't know if i'm on the right forum but for god sake help. PLEASE.
i'm on windows xp home edition and every time i try to open my documents or my folders the page comes up in blocks and then microsoft sends a message saying it must close the program, i check the error report then it comes up Dr Watson postmorton debugger,then closes. Help i've run 3 different anti-virus scans and only one showed an error (??chost) but cause it came up as an error it carn't delete it. please if anyone can help remove the virus or what ever the prob is can you site it.
please tell me what it is and how to remove it cause i really need to gain access to my files . thanks
sparra06
|
|
|
|
|
I'm using Visual Studio 2005 to edit my icons, but I cannot figure out how to paste a 256 color image onto my 32x32x256 icon. It always comes through 16-color. Any ideas?
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
Hi,
At the restart of the main application, I need to reload all the child windows that were opened and visible during the previous run of the application. I used persistent frames to obtain the state of each of the child windows and write into the registry. But during application restart I need these windows to come up automatically (that is those child windows that were not closed before the main application was closed).
Its the same as saving the workspace in visual C++ and when the workspace is opened again, all the child windows would come up automatically.
Can anyone help me with this.
Thanks
Vijay
|
|
|
|
|
hi
I need to get a list of all the computers on the LAN which are ON i.e. which are up.
For that i think the best option is to broadcast a connection request to all the systems on LAN and those who are up will be programmed to send something like their address.
I don't know how to broadcast a connection request. I have already made a client/server program in VC++, so i know the basic concepts.
If there is some material on NET, please refer.
thanx
|
|
|
|
|
The Q&D way is to send a broadcast PING on the network you are interested in. However, this has a few downsides.
You typically need Administrator access to send on the broadcast IP address, not all machines are required to respond to PING, and IT people tend to not like broadcast-ed traffic.
You might want to have a look at the network enumeration functions, and have a look at the "Enumerating Network Resources" sample for further options.
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
I have an object of
CStringArray m_arrString.
I have to add appriximatly eight (8) thousand values with the length of max 10 characters like "ABCD-EFGD" in the m_arrString using Add menthod of array, and i will sort them.
Would the CStringArray object will work fine for 8 thousand added values,
Or is there any other to handle them ,
thanks
Regards.
|
|
|
|
|
normally, it should work, as the index is an int , and so can contain up to 2147483648 values.
i'd personnaly use std::vector<> but you could ask Mr ABuenger (aKa xxx'd) about his preference...
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VCalc 3.0 soon...]
|
|
|
|
|
Thanks,
But will not it have any memory problems?
Regards.
|
|
|
|
|
zahid_ash wrote: But will not it have any memory problems?
like what ?
of course, it's take more memory than one which contain 3 or 4 strings, but if you talk about memory leaks for example, i don't think there is problems of this order...
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VCalc 3.0 soon...]
|
|
|
|
|
this is simple ...
try both ways, see how well they work, and decide yourself.
concerning memory, if you have sufficient memory on your computer there should not be any problem at all.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
If you are worried about memory and know in advance how many elements you are going to add and the max size of each element, you may want to allocate a regular C array rather than using collection classes which introduce some amount of overhead.
onwards and upwards...
|
|
|
|
|
zahid_ash wrote: I have to add appriximatly eight (8) thousand values...
Then you may want to set an initial size by first calling the SetSize() method. This would allocate a large chunk of memory once, rather than a small chunk of memory 8,000 times.
"The greatest good you can do for another is not just to share your riches but to reveal to him his own." - Benjamin Disraeli
|
|
|
|
|
Another way, which I have used, is to put the strings into large memory memory buffers one after the other (with terminating zeros between each, of course) and then store pointers to them in a CArray<>.)
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
I want to do a Total Commander in Visual C++, but I didn't find any control suitable to look like a pane.Can anyone give me some hints, please?
Thanks very much.
|
|
|
|