|
what is supposed to happen is..
as i enter the product name..and on clicking ok..
the prog should look for the record with that particular product name and fetch that particular record..in the specified location..
then...get the record and display it in the edit box in the dialogue box..
and shud exit!
what is haeppening is..this is giving an error!after diplaying in the edit box!
ranjani
|
|
|
|
|
ranjjj wrote:
this is giving an error!after diplaying in the edit box!
And that error would be ??
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Hi
I m new in this fied of VC.I have to do a project of Email Server soon.I need help about this.Any tutorial or guide book or any web site which could help me in this regard.And also some source code for my help in this project.I'll be thankfull to the person who helped me for this.Thanx
Muhammad Ali
|
|
|
|
|
search in www.planetsourcecode.com
|
|
|
|
|
You're new to VC, and one of your first projects is going to be an e-mail server. That's quite an undertaking. Good luck.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Hi all,
How do I run an exe as a service?
Thanks
BOBY
Boby
|
|
|
|
|
|
The service is created only when i logged in as administrator .Its not working in When i logged in as a Local User.
Thanks
BOBY
boby
|
|
|
|
|
Are you sure you really have permission to write where you want to write ?
|
|
|
|
|
I want to run my application first at win2k startup,before the other application run.
|
|
|
|
|
|
If you start your app from a windows service, then it will be running even before any user logon. Here is the a tool[^] that helps you to do that.
If the other application is also a window service, then you have to modify it so that it depends on your service. When a service depends on another service, windows will load the other service first.
P.S. Your app may have problems starting from a service. Typically this is a resource issue (somthing required is not available because nobody has logged on to the machine yet). There are ways to get around this problem, but not always.
My articles and software tools
|
|
|
|
|
What is the easiest way to find and send info to any window containing a certain string?
such as, if i wanted to find any window that has a title containing "- Notepad" and send the current time and date to the bottom...
|
|
|
|
|
If you want to find one window:
HWND FindWindow(
LPCTSTR lpClassName, // class name
LPCTSTR lpWindowName // window name
);
If you want to search for all:
HWND GetNextWindow(
HWND hWnd, // handle to current window
UINT wCmd // direction
);
int GetWindowText(
HWND hWnd, // handle to window or control
LPTSTR lpString, // text buffer
int nMaxCount // maximum number of characters to copy
);
Mickey
|
|
|
|
|
You can search for a window handle or a CWnd object by using the FindWindow-function.
When the call returns, you have either a pointer to CWnd representing this window (MFC version) or the window's HWND (API version). Then you can use this HWND e.g. to change window title by using SetWindowText-function, or if you use the MFC-version, you can use the CWnd to mess around with the window just as if you would have created it yourself. Change status bar, toolbar, menu, layout, minimize, maximize etc etc
What exactly is it that you want to do with the current time and date ? Should the target window display this on it's status bar ? Or draw it somewhere else inside it ? Want to hijack a window's Device Context ? Explain. The 'Send the current time and date to the bottom' isn't very informative
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
well, basically i want to add the current time and date to the bottom of the page in all open notepad windows, save and close them.... to remember where i left off at, and what date/time i was reading it.... but this is just for knowledge.. im not going to make a nice program out of it... just experimenting :-/
|
|
|
|
|
Ahh ok.
Let's create a general outline of the solution to this problem.
1. Find the window
2. Enumerate the views of this window
3. With each view, access the underlying document
4. Get this document's CString, and append the current date and time to the end.
5. Force window to save all it's open documents/views.
For a specific, Notepad-only solution, the outline is a bit different, because Notepad doesn't have any real views: it has one HUGE edit control.
Now, some code pieces. With the MFC-way, of course
<br />
CWnd* pNotepadWin = new CWnd;<br />
<br />
HWND hwndNotepad = ::FindWindow( ClassName, NULL ) );<br />
<br />
if ( hwndNotepad )<br />
{<br />
pNotepadWin->Attach( hwndNotepad );<br />
}<br />
else<br />
{<br />
delete pNotepadWin;<br />
return FALSE;<br />
}<br />
<br />
Now we have the CWnd representation of the Notepad window.
<br />
CWnd* pNotepadEdit;<br />
<br />
pNotepadEdit = pNotepadWin->GetTopWindow();<br />
<br />
if ( !pNotepadEdit )<br />
{<br />
pNotepadWin->Detach();<br />
<br />
delete pNotepadWin;<br />
return FALSE;<br />
}<br />
<br />
bool bContinue = true;<br />
while ( bContinue )<br />
{<br />
CString strName;<br />
<br />
::GetClassName(pNotepadEdit->m_hWnd, (LPTSTR) strName, 20);<br />
<br />
if ( strName.CompareNoCase("Edit") == 0 )<br />
bContinue = false;<br />
<br />
pNotepadEdit = pNotepadEdit->GetNextWindow(GW_HWNDNEXT);<br />
<br />
if ( !pNotepadEdit )<br />
{<br />
bContinue = false;<br />
}<br />
}<br />
<br />
Phew. That was some coding. But now we have the CWnd of the edit control inside Notepad. After this, it's easy to use 'GetWindowText' and 'SetWindowText' to append the current date and time to the edit control's contents.
Perhaps I should turn this into an article
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
What a perfect world it could be with out errors.
Going forth in a software developement I got to an error which I could not find a resource that give an answer.
It's about templates, and I must tell you that I'm new in this stuff.
Consider 'ClassA' which requiers template list when you want to define a object of it. Like this:
ClassA<long> obj;
And Consider another class that is the same to the previous one, 'ClassB' (with template list).
Now here's the problem, how can you define an object of 'ClassA' with the template list of 'ClassB' type, it should be something like this:
ClassA<ClassB> obj;
But compiler tells me that it has an error becuase 'ClassB' requiers a list of templates. So I thought that it might be defined like this:
ClassA<ClassB<long>> obj;
Now it has an another error:
error C2146: syntax error : missing ',' before identifier 'obj'
Well how can I define an object from a class with template list of sort of a class with template list?
|
|
|
|
|
Hi
The solution is pretty simple.
In stead of
ClassA<ClassB<long>> obj;
use
ClassA<ClassB<long> > obj;
Yes, the only difference is a space. The reason for the error is that the compiler finds '>>' and believes it to be the >> operator instead of the end of the template lists. So if you put in a space, the first > will end the inner template list and the second the outer and the compiler is happy.
|
|
|
|
|
Hello everybody,
I'm reading a .jpg file, everything goes fine, readhuge reports reading the hole file but what I've got in the buffer is just 4 bytes. What is ReadHuge reading ?
code:
buffer = new char[1000000];
if (buffer == NULL)
{
cout<<"Not enough memory";
return;
}
try
{
imageFile.Open(fileTitle,CFile::modeRead,&e);
imageFile.ReadHuge(buffer,1000000);
imageFile.Close();
CString output = header + buffer;
imageFile.Open("msg01",CFile::modeCreate | CFile::modeWrite,&e);
imageFile.WriteHuge((LPCTSTR) output,output.GetLength());
imageFile.Close();
delete []buffer;
}
|
|
|
|
|
The jpg contains binary NUL characters; your output = header + buffer statement will append the buffer up to the first NUL byte (or WORD, if you're using UNICODE), so GetLength() isn't giving you a big enough number.
Steve S
|
|
|
|
|
How to restore (maximize) my application instead of running a new instance when another instance is already running?
|
|
|
|
|
You could try to define a hook to maximize your app when you do smtg ... Or you could hit ALT-TAB
|
|
|
|
|
|
Somehow, before you create your app window, you need to find if another instance is running. One way is to use a named mutex that each instance tries to aquire. Another is to use the main window text as shown below (although not the suggested method) :
HWND h = ::FindWindowW(AppName, NULL);
if( h ) {
::SetForegroundWindow( (HWND)((ulong)h|0x00000001) );
return(true);
}
The key point in the above is not finding the app window, but how to restore it once found.
...cmk
Save the whales - collect the whole set
|
|
|
|