|
I see... It's a pity that didn't work, I'm sorry I don't have any other idea. Good luck with your quest.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
i want to put a color palette into my app, but i don't wanna use the CColorDialog class, coz i want a static palette like the one in the famous paint...can anyone help?
Thanx in advance
|
|
|
|
|
You mean just an array of buttons with different colours on them ? Where are you stuck ?
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"I'm thinking of getting married for companionship and so I have someone to cook and clean." - Martin Marvinski, 6/3/2002
|
|
|
|
|
yeah something like that, do u kn the famuos palettes pf colors in all the editor, paint, photoshop and all this stuff...
|
|
|
|
|
Like I said, it's just a whole lot of buttons, or you can draw the colours yourself and track the mouse messages yourself if you want to.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"I'm thinking of getting married for companionship and so I have someone to cook and clean." - Martin Marvinski, 6/3/2002
|
|
|
|
|
i got it, thank you so much
doudou
|
|
|
|
|
I tried using COleDateTime::ParseDateTime(...) and VarDateFromStr(...) to parse a date/time string that contains *time zone* information (ET, CT, +4:00, GMT+4:00, etc...) but every time I do so I get "Invalid DateTime"
// code //////////////////////
COleDateTime dt;
CString sdate = "Feb 1 2002 17:05 +7:00"; // <- Time Zone string date
dt.ParseDateTime(sdate);
CString st2 = dt.Format("%H:%M"); // <- returns 'Invalid DateTime'
// -----------------------------
Is it just me (am I doing this wrong) or the
ParseDateTime is no good for time zones?
Is there any other way/method that could parse string
with time zone information (like: "Feb 1 2002 17:05 +7:00").
JScript and VC#.NET have no problem parsing date/time strings with time zone info, but I can't seem to parse date/time string in VC++.
Platform: WinXP Pro, VC++.NET (unmanaged)
Thanks in advance
Mike
|
|
|
|
|
I'd like to show my codes while they are running. I wrote a macro for this perpose:
#define RUN_TRACE(instr) instr;TRACE("%s\n","instr");
But "instr" instead of my code was the result, and the macro below did not work either:
#define RUN_TRACE(instr) instr;TRACE("%s\n", instr);
This macro insist using the result of my code as the input to TRACE instead of the code itself.
Is there any compiler switch to control whether to replace the argument between quotion pare in macro definetion? I'll be very grateful if you can give me any help.
Tiny Flying Elephant loves flying...
|
|
|
|
|
This sould work (I think):
#define RUN_TRACE(instr) instr;TRACE("%s\n", #instr);
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
That works. Thanks a lot.
Tiny Flying Elephant
I love flying...
|
|
|
|
|
Hi
I created an ATL project in VC7, and chose to have it as a Service exe. I register it as a service (myservice.exe /service), and try to start it using the Service Control Manager. The SCM tells me it cannot start the service, and no error was returned.
I didn't touch a single piece of code. Why in hell can't a wizard produce code that works out of the box???
Btw, I have written some services in ATL 3.0 and didn't have any problem starting them
Tx
Michel
If I am wrong or said something stupid, I apologize in advance
|
|
|
|
|
I found the problem, and I will tell it here for the sake of sharing the knowledge.
When you create an ATL 7.0 Service, the CAtlExeModuleT::RegisterClassObjects method returns S_FALSE if there is no object to register. And in CAtlServiceModuleT::Run method, there is a line that says:
if (hr == S_OK) {
...
}
I overrode the Run function, and replaced the line by:
if (SUCCEEDED(hr)) {
...
}
and everything works fine.
Tx.
Michel
If I am wrong or said something stupid, I apologize in advance
|
|
|
|
|
Michou wrote:
if (hr == S_OK) {
instead of
Michou wrote:
if (SUCCEEDED(hr)) {
What
This is a f***ing beginner mistake , i don't f***ing believe that this was done on ATL 7 framework ! The guys have been doing serious drinking ...
Another stupid bug in a good framework !!!
Joao Vaz
|
|
|
|
|
How to hide a given column in a CListCtrl ?
thanx
|
|
|
|
|
You may try to set the column width to zero with a call to CListCtrl::SetColumnWidth. Note that users will be able to drag header dividers to make the column visible.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Thanx
|
|
|
|
|
Someone know how we can in MFC/Visual C++, send to the internet explorer a function made in javascript or dhtml to run in the browser ?
I want to make a button in MFC that send do the internet explorer (maby chtmlview) a function made in javascript, dhtml or asp.
Thanks
|
|
|
|
|
Maybe this is not what you're looking for, but I think you can just write an HTML file on the fly with the JavaScript code and then open it with ShellExecute (or whatever method you like to launch IE and load a page).
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
If you have a document loaded into a CHtmlView, you can use the Navigate() function to cause a javascript function to be executed:
vwHtml.Navigate("javascript:MyFunc();");
farewell goodnight last one out turn out the lights Smashing Pumpkins, Tales of a Scorched Earth
|
|
|
|
|
Do you need to put your stringarray adds in a try catch block, just in case there is not enough memory to allocate to the array? and if so, what error should you catch? Do you just catch CException or is there a more specific error?
|
|
|
|
|
Assuming that you're using VC6, there will be no exception when memory is exhausted during CStringArray operations. CStringArray::SetSize uses new operator to allocate memory for its slots, and doesn't even check for failure. Operator new in VC6 returns NULL when it fails to allocate, while C++ Standard requires it to throw bad_alloc.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
How about CMemoryException? Wouldn't that catch a CStringArray allocation failure?
|
|
|
|
|
|
Hi, the those are my client and server procedures using CSocket to send a file... When I run the programs onto a single machine, I receive the file without any problems...
But when I run them on two different computers, I get a different file... something is changing my buffer that I send via the socket. Can anyone help me? Does anyone know an article explaining how to use CSocketFile and an example source???
RECEIVING PROCEDURE:
UINT SendProcThread(LPVOID pParam)
{
size = 128;
CSocket sock;
sock.Create(12234);
sock.Listen();
CSocket recv;
sock.Accept(recv);
char num[20];
recv.Receive(num, 20, NULL);
length = atoi(num);
TRACE ("\n%d - length\n", length);
recv.Receive(num, 20, NULL);
int f_name_len = atoi(num);
TRACE("\n%d - name len\n", f_name_len);
char* name;
name = (char*) malloc(f_name_len);
recv.Receive(name, f_name_len, NULL);
strName = name;
strName.ReleaseBuffer(f_name_len);
TRACE("\n%s - name\n", strName);
int l = length/size;
char* buf;
buf = (char*) malloc(size);
try {
CFile file;
file.Open(strName, CFile::modeCreate | CFile::modeReadWrite, NULL);
for (int i=0; i<l; i++)="" {
="" recv.receive(buf,="" size,="" 0);
="" file.seek(size*i,="" cfile::begin);
="" file.write(buf,="" size);
="" }
="" length%size);
="" file.seek(size*l,="" file.close();
="" catch="" (cfileexception*="" e)="" e-="">ReportError();
e->Delete();
}
recv.Close();
sock.Close();
free(name);
free(buf);
CString msg;
msg.Format("%s file with legth %d has arrived!", strName, length);
AfxMessageBox(msg);
return 0;
}
SENDING PROC:
UINT SendFileThreadProc(LPVOID pParam)
{
size = 128;
char* buf;
buf = (char*) malloc(size);
CSocket socket;
socket.Create();
socket.Connect(m_dest_name, 12234);
char num[20];
itoa(length, num, 10);
socket.Send(num, 20, NULL);
TRACE ("\n%d - length\n", atoi(num));
itoa(m_strName.GetLength(), num, 10);
socket.Send(num, 20, NULL);
TRACE("\n%d - name len\n", atoi(num));
socket.Send(m_strName, m_strName.GetLength(), NULL);
TRACE("\n%s - name\n", m_strName);
int l = length/size;
try {
CFile file;
file.Open(m_strFileName, CFile::modeRead, NULL);
for (int i=0; i<l; i++)="" {
="" file.seek(i*size,="" cfile::begin);
="" file.read(buf,="" size);
="" socket.send(buf,="" size,="" 0);
="" }
="" file.seek(size*l,="" length%size);
="" length%size,="" file.close();
="" catch="" (cfileexception*="" e)="" e-="">ReportError();
e->Delete();
}
socket.Close();
free(buf);
return 0;
}
"Needless redundancy is the hobgoblin of software engineering." - Peter Darnell
|
|
|
|
|
(Please tick on the checkbox "Display this messahe as-is (no HTML)" when submitting code. Otherwise, your '<' s won't appear.)
I'd say (though I haven't thoroughly examined your code) that you are implicitly relying on the false assumption that CSocket::Read will read as many bytes as requested. Actually, the only guarantee is that the number of bytes read will be more than zero and not more than requested (unless the connection is closed and no more data is available.)
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|