|
Hi,
I am using ShellExecute for the first time. But, I am encountering the following error:
error C2065: 'ShellExecute' : undeclared identifier
I have included windows.h and shellapi.h ... shell32.lib is also there. Can somebody suggest me a way out of this problem.
Thanks,
|
|
|
|
|
In an MFC based application you don't need to include any specific files for ShellExecute.
What type of application are you using?
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
-- modified at 4:04 Wednesday 21st June, 2006
|
|
|
|
|
Perhaps you have included "shellapi.h" before "stdafx.h" . If so, move all of your #include directives after #include "stdafx.h" .
Hope it helps.
|
|
|
|
|
Thankyou! That was very helpful It worked.
--
Viorel. wrote: Perhaps you have included "shellapi.h" before "stdafx.h". If so, move all of your #include directives after #include "stdafx.h".
Hope it helps.
|
|
|
|
|
what application type?
whitesky
|
|
|
|
|
Noob mfc question:
What's the best way of creating forms like invoices and reports? Those reports have a strict layout.
What i got so far was printing pdf's or html. The problem with html is that though it's easyer to create..it's imposible to set page counts and so on.
Postscript would be a good ideea but i don't know how to display it in a MDI
|
|
|
|
|
I want to write a virtual cd-rom like Deamon tools(DAEMON'S HOME), but quite simple one. I just have a little basis on driver development.
What should i do if i want write such a virtual cd-rom? Could you please give me some advices or some links on internet, thanks!
Go go go, enemy sighted!
|
|
|
|
|
I need to lock a file stream(opened using fopen) in exclusive write lock. I came across a code segment where the functions flock() and fcntl() were used to lock the file. I need to have the header files unistd.h and sys/file.h in order to use these functions but these header files are not available. I am using Windows XP and Microsoft Visual C++. From where can I download these files?
|
|
|
|
|
I think the flock() function, unistd.h and file.h header files are only for Unix. In Windows, you can try _lock_file() function. Another way is _locking() function. For first argument, specify the value returned by _fileno() .
Alternatively you can try LockFile function as described at http://msdn.microsoft.com/library/en-us/dnucmg/html/UCMGch09.asp?frame=true[^].
Hope it helps.
|
|
|
|
|
Thanks for the hints. I tried using both _locking() and LockFile(). I did not use _lock_file() since it returns a void so I could not find if the file is opened by some other process or not.
if(_locking(_fileno(fd), LK_NBLCK, 10L )!=-1)
printf("Lock obtained on file!");
is always returning "Lock obtained on file!" even if the file is open by some other process and
if(LockFile(fd,0,0,0xffff0000,0))
printf("Lock obtained on file!");
else
printf("Could not obtain lock on file!");
is always printing "Could not obtain lock on file!" even if the file is not being used by any other process. I think the problem is with how many bytes to specify to be locked. I want exclusive lock on the whole file so as to ensure that I don't write to a file when the same is opened by some other process.
-- modified at 2:13 Thursday 22nd June, 2006
|
|
|
|
|
plz help me
plzzzzzzzzzzzzzzzzzzzz\
i dont understand by doing so the text movws its position once but does not contineously moves i want that it moves regularly plz send me code to help
\\\\\\
i hav made a dialog based application
now i want that onmy dialog i add "hello how r u" through Static control
now i want that it moves on the screen all the time fron left to right
like screen saver but i dont know how to do it
plz tel me and send me code to solve my problem
Please mail me
-- modified at 3:16 Wednesday 21st June, 2006
|
|
|
|
|
1.change the the id of static ctrl to some value say IDC_MOVING_TEXT
2.Set a timer using the SetTimer Function in the OnInitdialog function
3. In the on timer function call
GetDlgItem( IDC_MOVING_TEXT )->SetWindowPos( 0, x, y, 0,0, SWP_NOSIZE|SWP_NOZORDER);
decrement or increatement the x value to make the control move....
nave
|
|
|
|
|
Set a timer using the SetTimer Function in the OnInitdialog function
wat how i define one function inside other as u tel me to set timer using settime function inside OnInitdialog function
plz send me code for help
Please mail me
|
|
|
|
|
If u use MFC, add a handler for WM_TIMER and Call SetTimer to set interval
if SDK and callback function for WM_TIMER
Use SetTimer & KillTimer functions
|
|
|
|
|
plz can u send me code which help me as i do with this but it changes its position
and i want to move text regularly
plzzzzzzz
Please mail me
|
|
|
|
|
What do you need its not hard
whitesky
|
|
|
|
|
You can use MoveWindow() to set the coordinates of the static control
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
plz can u tel me some example of theat how it works
Please mail me
|
|
|
|
|
Suppose you have a dialog with a button on it. The dialog also has a static control with a variable associated as m_statictext. Now when you click the button the window changes its position. Say moves to (0,0) with some size.
This is only a general example. You will have to create a timer and then keep on changing the position of the window as per your requirement.(Also check for bounds)
//To test you can write this code on the click of the button and see the window changing its position
m_statictext.MoveWindow(CRect(0,0,100,100),1);
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
yes use MoveWindow or SetWindowPos
and if you need to timer in your program use SetTimer(500,1,NULL); (of course i suggest see MSDN for SetTimer)
then declare WM_TIMER message
void CAnswer::OnTimer(UINT nIDEvent)
{
}
in the end use KillTimer(500);
----------------
for static control insert one static in form and change id and declare a variable for this control
whitesky
|
|
|
|
|
Hi Friends,
I wanna some help on WinInet Programming.
I am writing a VC++ client which is supposed to communicate a web Server
written in C#.net.
I am able to send a request to Web Server but how to read the contents send by
WebServer can anybody help me in this ?
Following is my code:
HINTERNET hOpen,hConnect,hRequest;
BOOL retval;
DWORD dwErrorCode;//=12032;
CString data="cmdCreateSessionID";
hOpen=InternetOpen("HttpApp/1.0",
INTERNET_OPEN_TYPE_PRECONFIG,NULL,NULL,0);
hConnect=InternetConnect(hOpen,
SERVER_LAN_NAME,4000,
NULL,NULL,
INTERNET_SERVICE_HTTP,0,0);
CString method="POST";
CString url="index.html";
DWORD dwFlags=0;
hRequest=HttpOpenRequest(hConnect,method,url,
NULL, NULL, NULL, dwFlags, 0);
DWORD R1=GetLastError();
HttpSendRequest(hRequest,NULL,0,data.GetBuffer(),
data.GetLength());
dwErrorCode = hRequest ? ERROR_SUCCESS : GetLastError();
CString lpBuffer;
INTERNET_BUFFERS dwStruct;
DWORD dwNumberOfBytesToRead,dwNumberOfBytesRead;
dwNumberOfBytesRead=dwNumberOfBytesToRead=0;
BOOL retReadFile=InternetReadFile(hRequest,&lpBuffer,dwNumberOfBytesToRead,
&dwNumberOfBytesRead);
In the InternetReadFile function i am unable to read any buffer.
With Rgds
VC++
Girish
Software Developer
|
|
|
|
|
I want to read from Excel file. Pls provide me with any class or sample project that i can use with my application.
|
|
|
|
|
|
you can find the CRecordset in the web...
it can open the excel as database
void CExDlg::OnRead()
{
// TODO: Add your control notification handler code here
CDatabase database;
CString sDriver;
CString sDsn;
CString sFile,sPath;
//find the excel in main exe folder
GetModuleFileName(NULL,sPath.GetBufferSetLength (MAX_PATH+1),MAX_PATH);
sPath.ReleaseBuffer ();
int nPos;
nPos=sPath.ReverseFind ('\\');
sPath=sPath.Left (nPos);
sFile = sPath + "\\Demo.xls"; //name of excel
sDsn.Format("ODBC;DRIVER={%s};DSN='';DBQ=%s", sDriver, sFile);
TRY
{
database.Open(NULL, false, false, sDsn);
CRecordset recset(&database);
CString sSql;
sSql = "SELECT item FROM Regt WHERE item = 'iwant' "; //
// exe SQL
recset.Open(CRecordset::forwardOnly, sSql, CRecordset::readOnly);
BYTE line = 1;
// »ñÈ¡²éѯ½á¹û
while (!recset.IsEOF())
{
//¶ÁÈ¡ExcelÄÚ²¿ÊýÖµ
recset.GetFieldValue("item", sitem); // read out the item
line++;
//ÏÔʾ¼ÇÈ¡µÄÄÚÈÝ
m_listbox.AddString( sitem);
// ÒƵ½ÏÂÒ»ÐÐ
recset.MoveNext();
}
// close
database.Close();
}
CATCH(CDBException, e)
{
// Êý¾Ý¿â²Ù×÷²úÉúÒ쳣ʱ...
AfxMessageBox("error: " + e->m_strError);
}
END_CATCH;
}
|
|
|
|
|
Hi All,
I am unable to find which library file(.lib) need to use for this program.
Here i am including my code.
#include <stdio.h>
#include <fileref.h>
#include "tag.h"
using namespace std;
using namespace TagLib;
int main(int argc, char *argv[])
{
TagLib::FileRef f("DEV.mp3");
if(!f.isNull() && f.tag()) {
TagLib::Tag *tag = f.tag();
cout << "-- TAG --" << endl;
cout << "title - \"" << tag->title() << "\"" << endl;
cout << "artist - \"" << tag->artist() << "\"" << endl;
cout << "album - \"" << tag->album() << "\"" << endl;
cout << "year - \"" << tag->year() << "\"" << endl;
cout << "comment - \"" << tag->comment() << "\"" << endl;
cout << "track - \"" << tag->track() << "\"" << endl;
cout << "genre - \"" << tag->genre() << "\"" << endl;
}
return 0;
}
can anyone please help me for this problem.
waiting 4 ur earlier reply
bye
Trinadh
|
|
|
|