|
I think you've just solved my problem, and you replied 11 minutes after my post, thanks a million.
|
|
|
|
|
Daniel Salby wrote:
I think you've just solved my problem,
We aim to please here at CP.
Daniel Salby wrote:
and you replied 11 minutes after my post,
Yeah, sorry for the delay but my RSS client only checks the boards every 10 minutes and you posted just after a check.
he he he. I like it in the kitchen! - Marc Clifton (on taking the heat when being flamed)
Awasu v0.4a[^]: A free RSS reader with support for Code Project.
|
|
|
|
|
I've set up a scheduled task to run whenever a user logs on. After the desktop starts, the window is not visible. However the process is listed in the task manager process list.
I use explicit calls to ShowWindow and SetWindowPosition in the OnInitialUpdate function of the view class. So why doesn't the window appear when the desktop starts?
The program has to start every time a user logs on and it has to run with admin privilages so that users can't kill the process.
|
|
|
|
|
SJBenner wrote:
The program has to start every time a user logs on and it has to run with admin privilages
Meaning you run it under an account that's member of the Administratoprs group?
And where exactly would that "user" get the windows station and the desktop of the currently locally logged on user, and especially the privileges to use those objects?
Try reading this article, and you're in a much better position to do what you want to accomplish.
Personally I think you're nuts, running a process with admin privs on a users desktop, especially when we all know how easy it is to interact with such a window to gain full access to the machine.
If you want a better solution, you should probably run your service as just that, a service, and then let the UI run in the locally logged on users context, talking to the server using e.g. RPC.
|
|
|
|
|
Hi
I have a library which consists of header and source file. I created the Win32 Static Lib project in visual C++6. It then compiles ok and leaves some objects and .lib file in the Debug folder.
I then created another console project and attempt to reference the x.lib in the debug folder in the Win 32 Static Lib but it gives me 102 errors say "unknown character at 0x95" or something like that.
And when i double clik on the error to see where the error is in the editor, the message box pop up and say that the file is binary and can not be read.
Does any one know how to solve this problem??
Ah i also forgot to mention that i even have tried to add the x.lib into the link option in the project setting! This time it reduce to 3 error but alway say "undeclared identifer" which is quite weird to me since i know how i declare it is quite correct.
Regard,
Cuong Tong
|
|
|
|
|
It would be (more) productive if you provide the actual compiler /linker output. It is kind of difficult to guess from the information you supplied.
P.S. Before linking go to ProgectSettings->Link->Customize and check "Print process messages" box
|
|
|
|
|
Developing a network file backup application and need to
be able to see all machines on a network, select
drives/dirs/files for backup.... currently, I have an app
similar to Windows Explorer, with a treeview to look at
my own computer's data, with no problems... need to
add "My Network Places" to this (similar to Windows Explorer)
and be able to go out on
the network and get similar info for other
workstations.. plus I need to be able to create folders
and copy files to these PCs... any help or
suggestions would be much appreciated... thank you.
|
|
|
|
|
http://www.codeproject.com/treectrl/networktreectrl.asp
http://www.codeproject.com/file/
http://www.codeproject.com/treectrl/
any of these links maybe helpful to u. I hope it does the work for u.
cheers..
Himanshu
|
|
|
|
|
Is there a better way to write this very simple code?
// high score
#include <iostream.h>
void main()
{
int playersScore = 0;
int highScore[10] = {10525,9832,8145,6445,4540,3834,3106,2536,1879,928}; // default scores
int c = 0;
cout <<"High Scores\n";
do
{
cout <<"\n" <<c+1 <<="" "\t"="" highscore[c];
="" c++;
="" }
="" while="" (c="" <="" 10);
="" c="0;
" cout="" <<"\nenter="" players="" score="" :";
="" cin="">> playersScore;
if (playersScore < highScore[9])
cout <<"YOU SUCK!!!\n\n";
while (playersScore > highScore[9])
{
if (playersScore > highScore[0])
{
highScore[9] = highScore[8];
highScore[9] = highScore[8];
highScore[8] = highScore[7];
highScore[7] = highScore[6];
highScore[6] = highScore[5];
highScore[5] = highScore[4];
highScore[4] = highScore[3];
highScore[3] = highScore[2];
highScore[2] = highScore[1];
highScore[1] = highScore[0];
highScore[0] = playersScore;
break;
}
if (playersScore > highScore[1])
{
highScore[9] = highScore[8];
highScore[9] = highScore[8];
highScore[8] = highScore[7];
highScore[7] = highScore[6];
highScore[6] = highScore[5];
highScore[5] = highScore[4];
highScore[4] = highScore[3];
highScore[3] = highScore[2];
highScore[2] = highScore[1];
highScore[1] = playersScore;
break;
}
if (playersScore > highScore[2])
{
highScore[9] = highScore[8];
highScore[9] = highScore[8];
highScore[8] = highScore[7];
highScore[7] = highScore[6];
highScore[6] = highScore[5];
highScore[5] = highScore[4];
highScore[4] = highScore[3];
highScore[3] = highScore[2];
highScore[2] = playersScore;
break;
}
if (playersScore > highScore[3])
{
highScore[9] = highScore[8];
highScore[8] = highScore[7];
highScore[7] = highScore[6];
highScore[6] = highScore[5];
highScore[5] = highScore[4];
highScore[4] = highScore[3];
highScore[3] = playersScore;
break;
}
if (playersScore > highScore[4])
{
highScore[9] = highScore[8];
highScore[8] = highScore[7];
highScore[7] = highScore[6];
highScore[6] = highScore[5];
highScore[5] = highScore[4];
highScore[4] = playersScore;
break;
}
if (playersScore > highScore[5])
{
highScore[9] = highScore[8];
highScore[8] = highScore[7];
highScore[7] = highScore[6];
highScore[6] = highScore[5];
highScore[5] = playersScore;
break;
}
if (playersScore > highScore[6])
{
highScore[9] = highScore[8];
highScore[8] = highScore[7];
highScore[7] = highScore[6];
highScore[6] = playersScore;
break;
}
if (playersScore > highScore[7])
{
highScore[9] = highScore[8];
highScore[8] = highScore[7];
highScore[7] = playersScore;
break;
}
if (playersScore > highScore[8])
{
highScore[9] = highScore[8];
highScore[8] = playersScore;
break;
}
if (playersScore > highScore[9])
{
highScore[9] = playersScore;
break;
}
}
cout <<"\n\nHIGH SCORES";
do
{
cout <<"\n" <
|
|
|
|
|
Hey, you're back! Good on ya
The biggest problem here is that you have lots of repeated code e.g.
if (playersScore > highScore[3])
{
highScore[9] = highScore[8];
highScore[8] = highScore[7];
highScore[7] = highScore[6];
highScore[6] = highScore[5];
highScore[5] = highScore[4];
highScore[4] = highScore[3];
highScore[3] = playersScore;
break;
}
So, you have the repeated lines inside the if-statement. And then this kind of thing is repeated itself many times. Try using a for loop.
he he he. I like it in the kitchen! - Marc Clifton (on taking the heat when being flamed)
Awasu v0.4a[^]: A free RSS reader with support for Code Project.
|
|
|
|
|
I think, what you want to do is sort the players score into the 10 sorted scores. right ?
if you want that, try making the array size 11 (knowing you just have 10 valid entries). After the game, put the players score at place [10] (11th place) an begin a descending for loop at number 9 downto 0.
In the loop, do something like:
if(highscore[i]
|
|
|
|
|
What john has suggested is a simple bubble sort. If the data is completely unsorted, a full bubble sort needs two nested loops, to ensure everything gets to where it needs to be.
Are you doing this for fun or for homework ? If for homework, you'll need to take this sort of approach, because the idea is to learn. If for fun, the STL is a collection of containers and methods that work on them which makes this job very easy. You could either pass the values into a vector, and call sort on it, deleting the end item, or use a map, which sorts for you right away, and remove the lowest item. I suspect you're doing homework, so I won't elaborate further, but if you're able to use STL, check out my articles on the site, or ask some more.
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not
as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
In the Microsoft SDK, you will find this tool, (Dependency Walker) which appears to be quite sophisticated, but, for which the Microsoft MSDN site provides very little useful information. I'm wondering if any of you programmers have any thoughts or suggestions about its utility. Do any of you use this tool?
Feng Yuan, author of, Windows Graphics Programming has this to say about the Dependency Walker:
"Dependency Walker (depends.exe) lists all the DLLs your module imports implicitly in a nice recursive way. It helps you to get a clear understanding of how many modules will be loaded into your program when it's running, how many functions are imported. Check this simple MFC program; you will be amazed how many functions are imported without your knowledge. You can use it to check if a program will run on the initial version of Windows 95, which does not have system DLLs like urlmon.dll or provide so many exported functions in ole32.dll."
Is there source code available for us inexperienced code nitwits to investigate? I'd like to know how they did it. ...not that I'd actually understand it, but, I'm sure it would make interesting reading.
|
|
|
|
|
To produce good quality installation programs this tool is
essential. You need to use it to determine what DLLs to
include with your installation package.
You can cross check them here:
<http://support.microsoft.com/default.aspx?scid=/servicedesks/fileversion/dllinfo.asp&fp=1>
to eliminate ones that are certain to be on your user's computers.
Obvious, legal caveat, don't distribute Dlls that you don't
have the right to distribute.
Oh, one other thing that occasionally comes along to bite you,
sometimes other people's code loads the dll's by hand (LoadLibrary)
which is obviously not detected by the walker. This is a major
PITA, but it happens, and you have to watch out for it.
|
|
|
|
|
|
Its also helpful in tracing errors. You can sometimes find what function the error occurred in by looking up the address in Depends.
Jason Henderson start page ; articles
henderson is coming
henderson is an opponent's worst nightmare
* googlism *
|
|
|
|
|
I really appreciate the response, thank you. The tip about the LoadLibrary function and the website address were especially useful. Thanks.
|
|
|
|
|
Okay, this sounds like a simple question but I don't know where to look for info on it.
I want my program to be able to open user documentation. When it's a doc or txt file, I can just use ShellExecute() but, for unknown file types, it's going to need a default program to use. How do I have a program shell to a specific other program? For example, how do I tell Notepad to open a specific file?
|
|
|
|
|
ShellExecute(NULL,NULL,"NOTEPAD",<complete path and name of the file>,NULL,SW_SHOWNORMAL);
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hello,
I would like to know if there is any manner in which I can prevent my application (or its process) from exposing its diagnostic information to tools like Spy++.
Any pointers in this regard would be most helpful!
Thanks!
|
|
|
|
|
Write for Mac.
Seriously, there is no way to hide from Windows the fact that you're sending messages unless you stop sending messages.
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not
as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
I have an application where I want to hide the mouse pointer while the app is running and restore it when it exits. How would I do this?
|
|
|
|
|
Handle ( from memory ) WM_SETCURSOR, and set it to NULL.
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not
as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
Trying to track a linker problem, so I've created a new MFC app using the basic wizard in Visual Studio .NET to demonstrate the issue. Used all the default Wizard options. Have reduced the "InitInstance" function the the following :
BOOL CTestApp::InitInstance()
{
AFX_MODULE_THREAD_STATE temp;
return FALSE;
}
This complies and links in DEBUG configuration (obviously doesn't run, but that's not the point here).
In RELEASE configuration this compiles, but deos not link. Generates this :
Test error LNK2019: unresolved external symbol "public: __thiscall AFX_MODULE_THREAD_STATE::AFX_MODULE_THREAD_STATE(void)" (??0AFX_MODULE_THREAD_STATE@@QAE@XZ) referenced in function "public: virtual int __thiscall CTestApp::InitInstance(void)" (?InitInstance@CTestApp@@UAEHXZ)
Any help greatly appreciated - why is the linker failing to find this code in RELEASE builds only?
|
|
|
|
|
I am trying to create a very simple C++ POP3 client. I have the following code (minimilized for ease of reading) that will allow me to connect to a POP3 server, receive the Welcome, and send the user name. Trying to receive the response to the user name seems to "freeze" -- CPU usage stays low (<10%), but nothing seems to be happening. Any thoughts/suggestions/criticisms/praise?
<br />
CString sPOP3ServerIP = "valid.ip.address";<br />
CString m_sUsername = "ValidUser";<br />
CString m_sPassword = "ValidPassword";<br />
<br />
CSocket m_socket;<br />
m_socket.Close();<br />
if ((INVALID_SOCKET == m_socket.m_hSocket) || (NULL == m_socket.m_hSocket))<br />
{<br />
if (!m_socket.Create())<br />
{<br />
TRACE("Unable to create socket. Error code: %i\n", GetLastError());<br />
return;<br />
}<br />
}<br />
<br />
if (!m_socket.Connect(sPOP3ServerIP, 110))<br />
{<br />
TRACE("Unable to connect to %s. Error code: %i", sPOP3ServerIP, GetLastError());<br />
return;<br />
}<br />
<br />
TCHAR buff[4096];<br />
memset(buff, 0, 4096);<br />
int nRead;<br />
nRead = m_socket.Receive(buff, 4096); <br />
buff[nRead] = 0;
CString sTempMessage(buff); <br />
TRACE("Connected. Message received [%s]\n", sTempMessage);<br />
<br />
CString sMessageSend = "";<br />
int iLength = 0;<br />
if ("+OK" == sTempMessage.Left(3))<br />
{<br />
sMessageSend.Format("USER %s", m_sUsername);<br />
iLength = m_socket.Send(&sMessageSend, sMessageSend.GetLength());<br />
if (SOCKET_ERROR == iLength)<br />
{<br />
TRACE("Error %i on send USER NAME\n",GetLastError());<br />
return;<br />
}<br />
memset(buff, 0, 4096);<br />
<br />
nRead = m_socket.Receive(buff, 4096); <br />
<br />
buff[nRead] = 0;
CString sTempMessage(buff); <br />
TRACE("USER Sent. Message received [%s]\n", sTempMessage);<br />
<br />
<br />
sMessageSend.Format("PASS %s", m_sPassword);<br />
iLength = m_socket.Send(&sMessageSend, sMessageSend.GetLength());<br />
if (SOCKET_ERROR == iLength)<br />
{<br />
TRACE("Error %i on send PASS Word\n",GetLastError());<br />
return;<br />
}<br />
memset(buff,0,4096);<br />
nRead = m_socket.Receive(buff, 4096); <br />
buff[nRead] = 0;
CString sTempMessage1(buff); <br />
TRACE("PASS Sent. Message received [%s]\n", sTempMessage1);<br />
}<br />
<br />
sMessageSend.Format("QUIT");<br />
iLength = m_socket.Send(&sMessageSend, sMessageSend.GetLength());<br />
if (SOCKET_ERROR == iLength)<br />
{<br />
TRACE("Error %i on send QUIT\n",GetLastError());<br />
return;<br />
}<br />
memset(buff,0,4096);<br />
nRead = m_socket.Receive(buff, 4096); <br />
buff[nRead] = 0;
CString sTempMessage1(buff); <br />
TRACE("QUIT Sent. Message received [%s]\n", sTempMessage1);<br />
<br />
m_socket.Close();<br />
return;<br />
Thanks for any advice.
|
|
|
|
|