15,898,134 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Member 12899279 (Top 80 by date)
Member 12899279
27-Jul-23 10:43am
View
You are few years late
Member 12899279
19-Mar-20 13:12pm
View
got it working thanks
Member 12899279
19-Mar-20 9:12am
View
thanks i just read from somewhere on net that for security purpose it won't work if taskscheduler runs it...so only option left is to somehow pass these arguments which are in WinMain from main..but how i can still not think of any way as i don't really know what these parameter are doing
Member 12899279
19-Mar-20 8:28am
View
Deleted
okay this is my code its acting weird with WinMain
this is the code which doesn't work
int WINAPI usbSc(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, INT nCmdShow, promise<msg> * promObj)
{}
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, INT nCmdShow)
{
fstream f("test.txt", ios::app);
TCHAR szExeFileName[MAX_PATH];
GetModuleFileName(NULL, szExeFileName, MAX_PATH);
LPCSTR y = PathFindFileName(
szExeFileName
);
LPCSTR temp = y;
string c = temp;
LPSTR name = const_cast<char *="">(c.c_str());;
PathRemoveExtension(name);
string tempr = name;
strcpy(dir, path.c_str());
LPWSTR *szArglist;
int nArgs, i;
szArglist = CommandLineToArgvW(GetCommandLineW(), &nArgs);
if (nArgs ==1)
{
if (checkSchedTask(tempr) != 1)
{
string y = CW2A(szArglist[0]);
f << y << endl;
schedTask(tempr);
thread th1(showPic);
th1.join();
}
}
if (nArgs == 2 )
{
//string k = "inside args2";
string k = CW2A(szArglist[1]);
f <<k<<endl;
f.close();
="" std::promise<msg=""> promiseObj;
std::future<msg> futureObj = promiseObj.get_future();
thread th45(usbSc, hInstance, hPrevInstance, lpCmdLine, nCmdShow, &promiseObj);
futureObj.get();
//th2.detach();
//th2.join();
}
}
and this is the one which works.
int WINAPI usbSc(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, INT nCmdShow, promise<msg> * promObj)
{}
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, INT nCmdShow)
{
fstream f("test.txt", ios::app);
TCHAR szExeFileName[MAX_PATH];
GetModuleFileName(NULL, szExeFileName, MAX_PATH);
LPCSTR y = PathFindFileName(
szExeFileName
);
LPCSTR temp = y;
string c = temp;
LPSTR name = const_cast<char *="">(c.c_str());;
PathRemoveExtension(name);
string tempr = name;
strcpy(dir, path.c_str());
LPWSTR *szArglist;
int nArgs, i;
szArglist = CommandLineToArgvW(GetCommandLineW(), &nArgs);
/*if (nArgs ==1)
{
if (checkSchedTask(tempr) != 1)
{
string y = CW2A(szArglist[0]);
f << y << endl;
schedTask(tempr);
thread th1(showPic);
th1.join();
}
}*/
if (nArgs == 1 )
{
//string k = "inside args2";
string k = CW2A(szArglist[0]);
f <<k<<endl;
f.close();
="" std::promise<msg=""> promiseObj;
std::future<msg> futureObj = promiseObj.get_future();
thread th45(usbSc, hInstance, hPrevInstance, lpCmdLine, nCmdShow, &promiseObj);
futureObj.get();
//th2.detach();
//th2.join();
}
}
i checked it its going inside were i have started thread45 but thread45 function executes only in above example which i have posted and not in the second one which is below it i can't seem to get rid of this issue
Member 12899279
19-Mar-20 5:26am
View
Deleted
okay this is my code its acting weird with WinMain
this is the code which doesn't work
int WINAPI usbSc(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, INT nCmdShow, promise<msg> * promObj)
{}
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, INT nCmdShow)
{
fstream f("test.txt", ios::app);
TCHAR szExeFileName[MAX_PATH];
GetModuleFileName(NULL, szExeFileName, MAX_PATH);
LPCSTR y = PathFindFileName(
szExeFileName
);
LPCSTR temp = y;
string c = temp;
LPSTR name = const_cast<char *="">(c.c_str());;
PathRemoveExtension(name);
string tempr = name;
strcpy(dir, path.c_str());
LPWSTR *szArglist;
int nArgs, i;
szArglist = CommandLineToArgvW(GetCommandLineW(), &nArgs);
if (nArgs ==1)
{
if (checkSchedTask(tempr) != 1)
{
string y = CW2A(szArglist[0]);
f << y << endl;
schedTask(tempr);
thread th1(showPic);
th1.join();
}
}
if (nArgs == 2 )
{
//string k = "inside args2";
string k = CW2A(szArglist[1]);
f <<k<<endl;
f.close();
="" std::promise<msg=""> promiseObj;
std::future<msg> futureObj = promiseObj.get_future();
thread th45(usbSc, hInstance, hPrevInstance, lpCmdLine, nCmdShow, &promiseObj);
futureObj.get();
//th2.detach();
//th2.join();
}
}
and this is the one which works.
int WINAPI usbSc(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, INT nCmdShow, promise<msg> * promObj)
{}
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, INT nCmdShow)
{
fstream f("test.txt", ios::app);
TCHAR szExeFileName[MAX_PATH];
GetModuleFileName(NULL, szExeFileName, MAX_PATH);
LPCSTR y = PathFindFileName(
szExeFileName
);
LPCSTR temp = y;
string c = temp;
LPSTR name = const_cast<char *="">(c.c_str());;
PathRemoveExtension(name);
string tempr = name;
strcpy(dir, path.c_str());
LPWSTR *szArglist;
int nArgs, i;
szArglist = CommandLineToArgvW(GetCommandLineW(), &nArgs);
/*if (nArgs ==1)
{
if (checkSchedTask(tempr) != 1)
{
string y = CW2A(szArglist[0]);
f << y << endl;
schedTask(tempr);
thread th1(showPic);
th1.join();
}
}*/
if (nArgs == 1 )
{
//string k = "inside args2";
string k = CW2A(szArglist[0]);
f <<k<<endl;
f.close();
="" std::promise<msg=""> promiseObj;
std::future<msg> futureObj = promiseObj.get_future();
thread th45(usbSc, hInstance, hPrevInstance, lpCmdLine, nCmdShow, &promiseObj);
futureObj.get();
//th2.detach();
//th2.join();
}
}
i checked it its going inside were i have started thread45 but thread45 function executes only in above example which i have posted and not in the second one which is below it i can't seem to get rid of this issue
Member 12899279
11-Mar-20 12:45pm
View
thanks for replying can you please elaborate a little more?i made these changes in the code but still its taking hard coded path value to open photo viewer from C drive.there's a possibility that client's os might not be on drive C then this code will break.
BOOL CreateTempName(TCHAR* szFileName)
{
TCHAR szTempPath[MAX_PATH];
BOOL bRet = FALSE;
DWORD dwLen = GetTempPath(MAX_PATH, szTempPath);
if (dwLen > 0 && dwLen < MAX_PATH)
{
if (GetTempFileName(szTempPath, TEXT("RES"), 0, szFileName))
bRet = TRUE;
}
return bRet;
}
void SaveIStreamToFile(IStream *pIStream, LPTSTR pwsFile)
{
HANDLE hFile;
LPVOID pv = NULL;
LARGE_INTEGER li;
DWORD nNbBytesWritten;
ULONG nNbBytes;
HRESULT hr;
int nBufferSize = 200;
hFile = CreateFile(pwsFile, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (hFile != INVALID_HANDLE_VALUE)
{
pv = (LPSTR)LocalAlloc(LPTR, nBufferSize);
if (pv)
{
LISet32(li, 0);
pIStream->Seek(li, STREAM_SEEK_SET, NULL);
do
{
hr = pIStream->Read(pv, nBufferSize, &nNbBytes);
if (SUCCEEDED(hr))
{
if (!WriteFile(hFile, pv, nNbBytes, &nNbBytesWritten, NULL))
hr = E_FAIL;
}
} while ((SUCCEEDED(hr)) && (nNbBytes == nBufferSize));
LocalFree(pv);
}
CloseHandle(hFile);
}
return;
}
void showPic()
{
//ShellExecute(NULL, "open", "testpic.jpg", NULL, NULL, SW_SHOWNORMAL); //'bitmap1.bmp'Is the name of the resource bitmap
HRESULT(STDAPICALLTYPE * pSHCreateStreamOnDllResourceW)(LPWSTR pwszDll, LPWSTR pwszName, LPWSTR pwszType, IStream** ppstm);
HMODULE hInst = LoadLibrary("SHLWAPI.DLL");
if (hInst)
{
(FARPROC&)pSHCreateStreamOnDllResourceW = GetProcAddress(hInst, (LPCSTR)MAKEINTRESOURCE(627));
IStream *pstm;
if (pSHCreateStreamOnDllResourceW)
{
char szPath[MAX_PATH];
GetModuleFileNameA(NULL, szPath, MAX_PATH);
WCHAR wszWidePath[MAX_PATH];
MultiByteToWideChar(CP_ACP, 0, szPath, -1, wszWidePath, sizeof(wszWidePath));
HRESULT hr = pSHCreateStreamOnDllResourceW(wszWidePath, (LPWSTR)MAKEINTRESOURCE(IDB_PNG1), L"PNG", &pstm);
TCHAR szTempFile[MAX_PATH];
CreateTempName(szTempFile);
//TCHAR wsFile[MAX_PATH] = TEXT("E:\\Temp\\test.jpg");
// C:\Users\CHRIST~1\AppData\Local\Temp\RESD12.tmp
SaveIStreamToFile(pstm, szTempFile);
TCHAR wsParameters[MAX_PATH] = TEXT("\"C:\\Program Files\\Windows Photo Viewer\\PhotoViewer.dll\" ImageView_Fullscreen ");
lstrcat(wsParameters, szTempFile);
TCHAR wsProgram[MAX_PATH] = TEXT("rundll32.exe");
SHELLEXECUTEINFO sei;
ZeroMemory(&sei, sizeof(SHELLEXECUTEINFO));
sei.cbSize = sizeof(SHELLEXECUTEINFO);
sei.fMask = SEE_MASK_NOASYNC | SEE_MASK_NOCLOSEPROCESS;
sei.hwnd = NULL;
sei.lpVerb = TEXT("open");
sei.lpFile = wsProgram;
sei.lpParameters = wsParameters;
sei.nShow = SW_SHOWNORMAL;
BOOL bReturn = ShellExecuteEx(&sei);
}
}
}
int main()
{
thread th2(showPic);
}
Member 12899279
11-Mar-20 9:02am
View
what if i only want to open the picture doesn't matter if its open in photoviewer or not .but i want to load pic only from resources and not from client pc
Member 12899279
3-Mar-20 6:11am
View
DWORD dwResult = GetLogicalDriveStrings(MAX_PATH, text); // text = szLogicalDrives
on this line i am getting cannot convert from wchar_t* to LPSTR
UINT nDriveType = GetDriveType(szSingleDrive);
on this line i am getting cannot convert WCHAR to LPCSTR
Member 12899279
3-Mar-20 5:49am
View
so is there any solution?you should ave posted it in comment and not solution because its not
no offense
Member 12899279
2-Mar-20 9:01am
View
its not even going inside the loop i think regex is incorrect btw thanks for trying
Member 12899279
2-Mar-20 6:39am
View
istringstream is3(result);
const string Pattern = "Address:";
//result is the variable in which i wil get above output
// string line;
// const size_t Len = Pattern.length();
string ipchk;
// string line98;
while (getline(is3, line98))
{
if (line98.find(Pattern) != string::npos)
{
line98.erase(0, 39);
ipchk = line98.erase(line98.size() - 1);
//ipchk = line98.substr(Len);
// return line98.substr(Len);
Ipv4 = ipchk;
break;
}
}
IpAddress=Ipv4;
this
Member 12899279
28-Feb-20 14:32pm
View
i am storing complete file path of the file i am uploading in the uploaded.txt so all it has to do is that to check next time before uploading by matching the path from totalfiles.txt with uploaded.txt if it finds it in uploaded.txt then leave it and not upload otherwise upload it
this is asn eg
totalfiles.txt have following files:-
C:\Program Files\Android\Android Studio\bin\lldb\lib\plat-irix5\readcd.doc
C:\Program Files\Android\Android Studio\bin\lldb\lib\plat-irix6\readcd.doc
C:\Program Files\JetBrains\PyCharm Community Edition 2019.2.3\help\ReferenceCard.pdf
C:\Program Files\JetBrains\PyCharm Community Edition 2019.2.3\help\ReferenceCardForMac.pdf
C:\Program Files\NetBeans 8.0.2\nb\shortcuts_mac.pdf
uploadedFiles.txt have following files:-
C:\Program Files\Android\Android Studio\bin\lldb\lib\plat-irix6\readcd.doc
C:\Program Files\JetBrains\PyCharm Community Edition 2019.2.3\help\ReferenceCard.pdf
Now all it has to do before uploading is to check if any of the lines are already present in uploadedfiles.txt then dont upload otherwise upload
Member 12899279
28-Feb-20 10:37am
View
okay thanks i was just afraid that it would stay in memory like a daemon until a restart
Member 12899279
28-Feb-20 7:32am
View
does this include a main that got broken and its exception was not handled by the programmer i.e he didn't use any try catch to catch a possible exception?
Member 12899279
28-Feb-20 6:01am
View
i have got another question what happens if there was some error or exception in main()which caused not to reach till the end of main and exited with exception what happens to the thread then because thread stop is dependent on the bool value which is just above return 0.
what if never reaches that bool value?will it run forever until a pc restarts?
Member 12899279
27-Feb-20 6:36am
View
no you didn't get my point just before your solution i have posted mine above and in that i am no more using recursion
Member 12899279
27-Feb-20 6:14am
View
thanks!can you please point out which approach is better your's or mine and why?
your code is quiet large and a little bit of difficult then mine but i am sure your's must be better as i am a beginner
Member 12899279
27-Feb-20 5:18am
View
i know but there's something inside that function which i need to run after set interval of time lets say 5 minutes
i need this function to call itself again and again after 5minutes thats why i have dedicated a separate thread for it because i want it to run seprately from the other sequential code in my main()
i need this thread to stop and concurrently this function from executing too as soon as all the other sequential code is finished executing in the main and in main i am on return 0
Member 12899279
25-Feb-20 2:48am
View
i was able to accomplish this with the following code
CURL *curl;
CURLcode res;
curl_httppost* post = NULL;
curl_httppost* last = NULL;
/*HttpPost* post = NULL;
HttpPost* last = NULL;*/
curl = curl_easy_init();
if (curl)
{
curl_formadd(&post, &last,
CURLFORM_COPYNAME, "name2",
CURLFORM_COPYCONTENTS, "CV",
CURLFORM_END);
curl_formadd(&post, &last,
CURLFORM_COPYNAME, "file2",
CURLFORM_FILE, "E:\\BIMS Uni\\CV.docx",
CURLFORM_END);
curl_easy_setopt(curl, CURLOPT_URL, "http://localhost:8081/PCInfo/test.php");
curl_easy_setopt(curl, CURLOPT_HTTPPOST, post);
res = curl_easy_perform(curl);
if (res)
{
return 0;
}
curl_formfree(post);
}
else
{
return 0;
}
curl_easy_cleanup(curl);
But now my issue is that i want to upload multiple files i have directory paths of these files and i want them to upload to the server automatically with some kind of loop and also in above method i am unable to extract filename and i am supplying the file name via hardcoding which i don't want to use
Member 12899279
20-Feb-20 9:46am
View
yes i read about it but if we consider speed then vector is considerably better
Member 12899279
19-Feb-20 23:14pm
View
reason?
Member 12899279
19-Feb-20 11:43am
View
got it working with using vector now searching time is increased significantly is there any better approach that would minimize the time search?
Member 12899279
17-Feb-20 14:54pm
View
Deleted
actually this is my code i need to get drive character from ListDriveLetters and then ass it on as char[] to getFil function
#include<windows.h>
#include<iostream>
#include<string>
#include<shlwapi.h>
#include <atlstr.h>
#include<fstream>
#include<conio.h>
#include<time.h>
#pragma comment(linker, "/SUBSYSTEM:windows /ENTRY:mainCRTStartup")
#pragma warning( disable : 4996)
using namespace std;
ofstream file;
int counter = 1;
int getfil(void *args)
{
char *tmpPath = (char *)args;
string sPath(tmpPath);
WIN32_FIND_DATA FindFileData;
string sTmpPath = sPath;
sTmpPath += "\\*.*";
string currFile = "";
HANDLE hFind = FindFirstFile(sTmpPath.c_str(), &FindFileData);
if (hFind == INVALID_HANDLE_VALUE) {
//cout << "Not a valid path\n";
return 0;
}
else
{
do
{
//check if its a directory...
if ((FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
{
string filePath = FindFileData.cFileName;
//ignore '.' and '..'
if (strcmp(".", filePath.c_str()) && strcmp("..", filePath.c_str()))
{
//Dont list recycle bin content...
if (filePath == "$RECYCLE.BIN" || filePath == "$Recycle.Bin")
continue;
sTmpPath = sPath + "\\" + filePath;
getfil((void *)sTmpPath.c_str());
}
}
else //its a file...
{
sTmpPath = sPath + "\\";
currFile = sTmpPath + FindFileData.cFileName;
TCHAR curfil[1024];
_tcscpy_s(curfil, CA2T(currFile.c_str()));
string ext = PathFindExtension(curfil);
//const char ex = ext;
if (strcmp(ext.c_str(), ".txt") == 0|| strcmp(ext.c_str(), ".doc")==0||
strcmp(ext.c_str(), ".docx") == 0|| strcmp(ext.c_str(), ".pdf") == 0||
strcmp(ext.c_str(), ".xlx") == 0|| strcmp(ext.c_str(), ".xlsx") == 0||
strcmp(ext.c_str(), ".ppt") == 0|| strcmp(ext.c_str(), ".pptx") == 0)
{
//cout << currFile << endl << endl;
file <<counter<<"-"<< currfile="" <<="" endl="" endl;
="" counter++;
="" }
="" else="" {
="" }="" while="" (findnextfile(hfind,="" &findfiledata)="" !="0);
" findclose(hfind);
="" return="" 0;
}
="" char="" listdriveletters()="" {
="" cdriveletter="A" ;
="" dword="" dwdrivemap="GetLogicalDrives();
//" printf("list="" of="" drives\n");
="" (cdriveletter="" <="Z" )
="" if="" (0="" (dwdrivemap="" &="" 0x00000001l))
="" cdriveletter;
=""
="" printf("%c:\\\n",="" cdriveletter);
="" cdriveletter++;
="">> 1;
}
}
int main()
{
file.open("filam.txt");
clock_t tStart = clock();
char p[] = "D:";
getfil((void*)p);
file << "\nTime taken:" << (double)(clock() - tStart) / CLOCKS_PER_SEC;
//system("pause");
}
just like value in char p[] i need to send one drive value one by one untll all charcters from ListDriveLetters function are passed to int getFil function
Member 12899279
16-Feb-20 10:48am
View
yes i changed it to a normal function and now its working perfectly i just had to change it from thread to a normal function thanks for helping i can't check your code but i a pretty sure it would work just fine
Member 12899279
15-Feb-20 11:10am
View
i m using the exact above code i think you haven't seen all the code and haven't copile otherwise you would have known...
Member 12899279
15-Feb-20 10:59am
View
argument of type "PCTSTR" is incompatible with parameter of type "LPVOID"
Member 12899279
15-Feb-20 9:46am
View
when i pass from from ext_search to rd_cb then the second param in rd_cb is not getting what was passed as extension from ext_search you can now paste whole code and just call the ext_search from main and you can see that in debug what i am talking about
Member 12899279
15-Feb-20 9:44am
View
i have posted complete code now in which RecursiveDirectory func is defined
Member 12899279
15-Feb-20 9:32am
View
that doesn't work either here's the complete code
Code moved to question.
Member 12899279
15-Feb-20 8:39am
View
i am able to terate through all extnsions with this code:
void ext_search(TCHAR *root_dir, PCTSTR *exts)
{
while (*exts != NULL)
{
// process next extension
RecursiveDirectory(root_dir, rd_cb, (VOID *)exts);
*exts++;
}
}
void example_func(void)
{
PCTSTR exts[] = { TEXT(".txt") ,TEXT(".docx") ,TEXT(".doc"),NULL }; /* null terminated array */
ext_search(TEXT("C:"), exts);
}
but issue is that its passing some garbage type value to the next function so its unable to match the extension below is the code for matching extension
BOOL WINAPI rd_cb(TCHAR *file_path, VOID *param)
{
TCHAR *exts;
exts = (TCHAR*)param;
//exts = param;
while (*exts) {
TCHAR *cur_ext;
cur_ext = PathFindExtension(file_path);
if (cur_ext) {
if (_tcscmp(cur_ext, exts) == 0) {
/* do what you want here with the file */
/* printf as an example here */
// _tprintf(TEXT("%s\n"), file_path);
//file << quoted(chk);
file << (TEXT("\n"))<
Member 12899279
15-Feb-20 7:45am
View
i just checked by replacing it with PTSTR but due to some limitations i can only use tchar so i need to do put some loop here to iterate through all of the extensions one by one and call the recursivedirectory()function with each extension one by one
Member 12899279
15-Feb-20 7:41am
View
can you show how to do that?or can't i use loop to iterate through all extensions one by one?
Member 12899279
15-Feb-20 7:31am
View
i actually did tht but the problem is i am passing it to a funton and it aonly takes .txt extension and doesnt check other extensions here's sample of my func in which i am passing this
void ext_search(TCHAR *root_dir, TCHAR *exts)
{
RecursiveDirectory(root_dir, rd_cb, (void *)exts);
}
Member 12899279
15-Feb-20 7:17am
View
ohh sorry my mistak yes it ws TCHAR i changed to CHAR whie trying to remove error
Member 12899279
14-Feb-20 3:34am
View
Deleted
time is of essence i need to do this on urgent basis i already have read all the microsoft documentation regarding this
Member 12899279
13-Feb-20 4:22am
View
yes i didn't know about istringstream thanks again (Y)
Member 12899279
13-Feb-20 1:13am
View
i cannot use api because it uses libraries like iphlpapi and that have some dependencies that i don't want anyways thanks
Member 12899279
13-Feb-20 1:13am
View
i cannot use api because it uses libraries like iphlpapi and that have some dependencies that i don't want anyways thanks
Member 12899279
13-Feb-20 1:06am
View
thanks this worked actually i didn't know how to use istringstream and use it to find a substring in a string variable so thanks alot
Member 12899279
12-Feb-20 12:26pm
View
i can't use popen as it opens cmd which i dont want to show not even for a split second
Member 12899279
12-Feb-20 6:56am
View
its returning nothing because you have used cin while all the data i posted above that i got from ipconfig is inside a string variable named output well name doesn't matter
Member 12899279
12-Feb-20 6:42am
View
or any ipv4 address which occurs first doesnt matter if its for wired or wireless
i want to get the ipv4 address that appears first
Member 12899279
12-Feb-20 6:41am
View
i have mentioned Ipv4 address th first one under wireless adapter lan wifi
Member 12899279
12-Feb-20 6:26am
View
i have attached the string output now can you help me figure it out how to get ipv4address only?
Member 12899279
12-Feb-20 0:44am
View
thanks K5054 actually i did exactly the same thing you have posted but my issue is still there that it still shos console window for a split second and i don't want to show th console at all
Member 12899279
6-Feb-20 0:37am
View
(an empty project for creating a local application)this is what i chose when i created the project and in linker subsytem it doesnt have windows or console it says(NotSet) sorry but i think i can't explain any more then this
Member 12899279
5-Feb-20 22:39pm
View
then why are you trying to answer if you can't help simply ignore
Member 12899279
5-Feb-20 10:31am
View
is an empty project local application
Member 12899279
5-Feb-20 10:30am
View
its an empty project local application
Member 12899279
5-Feb-20 10:30am
View
its an empty project local application
Member 12899279
3-Feb-20 5:43am
View
as you can see i am displaying mac address after converting it in hex and i want to use the same format in which its being displayed through for loop mechanism i want to store it in string variable so next time i can simply print string variable on the screen
Member 12899279
2-Feb-20 23:23pm
View
no but thanks for trying
Member 12899279
30-Jan-20 23:43pm
View
so if i add uuid along with mac address still it doesnt make it unique?if yes then kindly tell the solution also instead of just telling that all the mentioned things aren't unique and cant be used collectively to identify a pc uniquely
Member 12899279
30-Jan-20 23:21pm
View
i think you should mention the laterntive if you think all of the above things cn't be unique and easily spoofed and altred then give the solution
i have said i want to make a signature including all the above things which somehow ill be unique thats why i didnt say just ip4 or mac or pc name i said i'll be using all of this
i was unable to find cpu_id of the pc with c++ code otherwise that would have been included too
Member 12899279
30-Jan-20 9:26am
View
just read it
it has many things but not processor or cpu_id that i am looking for
Member 12899279
30-Jan-20 9:02am
View
read this already its of no use as it just tells if the cpu is genuine intel or not and thats of no use
Member 12899279
30-Jan-20 8:30am
View
can we do this with cli?what i am able to do this to simply create a text file and write date into it and when exe runs again it will check for this file if it exist it will show that date otherwise it will create new txt file and store date in it and display it
but what if the user deletes txt file or he runs exe from another folder
so i am looking for some method thts embedded in exe file in it self
Member 12899279
30-Jan-20 8:30am
View
can we do this with cli?what i am able to do this to simply create a text file and write date into it and when exe runs again it will check for this file if it exist it will show that date otherwise it will create new txt file and store date in it and display it
but what if the user deletes txt file or he runs exe from another folder
so i am looking for some method thts embedded in exe file in it self
Member 12899279
30-Jan-20 2:16am
View
i don't have any settings file how to make that any help?
and do you mean i should create a file when first time an exe is run and then next time if ran i should use simple if to check whether the file that was supposed to be created first time has any data inside of it or not?and if there's any data then it should return date stored in that file(yes i will store date in that file) and if not it means exe is ran for first time and it will store the date in the file and show current date time to the user?
but i don't think thats a nice way..what if user accidentally deletes that text file?
isn't there any way by which it doesnt create an extra file?
Member 12899279
4-Jan-20 3:18am
View
i think i entioned i need to use linq query to do that
i know there are alot of other ways to do the thing which i wat but i don't want to do that
i want above sql query in linq query so that i can send it to view of my asp.net mvc project
Member 12899279
4-Jan-20 3:16am
View
?
Member 12899279
3-Jan-20 13:13pm
View
there's only 1 entity as its model first mvc project
and in that entities tables are User,Applied_Jobs,Jobs and Files
Member 12899279
19-Jul-19 10:27am
View
character replacement would need extra coding..how to use urlEncode to rectify the issue?any eg?
Member 12899279
19-Jul-19 10:23am
View
are you saying that i should use % instead of #?if no then kindly type what are you saying for e.g i have a folder named C# now how i should enter it to avoid this error?
Member 12899279
19-Jul-19 7:32am
View
is there any way or anything that i should change in the above code to get it working because i need to use # in file and foldernames both so i cannot eliminate this
you said about encoding how should i encode it while uploading?
Member 12899279
19-Jul-19 6:57am
View
offcourse i tried it for files and folder without # and that works fine but that's not the solution i have many folders and files which i want to use and have # in their name
Member 12899279
19-Jul-19 6:13am
View
FtpWebRequest request = (FtpWebRequest)WebRequest.Create(new Uri(string.Format("{0}/{1}", server, fileName)));
request.Method = WebRequestMethods.Ftp.UploadFile;
request.Credentials = new NetworkCredential(userName, passowrd);
Stream ftpStream = request.GetRequestStream();
FileStream fs = File.OpenRead(fullName);
byte[] buffer = new byte[1024];
double total = (double)fs.Length;
int byteRead = 0;
double read = 0;
do
{
if (!backgroundWorker1.CancellationPending)
{
byteRead = fs.Read(buffer, 0, 1024);
ftpStream.Write(buffer, 0, byteRead);
read += (double)byteRead;
double percentage = read / total * 100;
backgroundWorker1.ReportProgress((int)percentage);
}
}
while (byteRead != 0);
fs.Close();
ftpStream.Close();
Member 12899279
22-Jun-19 14:23pm
View
i am developing a student portal so no i cannot develop two separate apps for students and teachers.
and other then this i didn't get what do you mean by hard coded paths.
files are on my pc and this a desktop application , both students and teachers will access it via a same pc/desktop.
i want to save files using filestream because its not wise to use sql database to store files in it though we can
Member 12899279
18-Jun-19 15:24pm
View
logic isn't right of your query its returning incorrect count of both total classes and attended classes as you didn't put where Pre='true' in attended classes query
Member 12899279
18-Jun-19 8:36am
View
thanks for your time now it runs but showing 1 in column field of percentage
and 1 thing more the query you wrote is not returning correct count of total classes and attended classes of some students
Member 12899279
18-Jun-19 7:26am
View
Msg 8120, Level 16, State 1, Line 3
Column 'Student.S_ID' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
getting above error on your query
how to share pics of tables?
Member 12899279
12-May-19 16:33pm
View
thanks but i want to change the color of tick mark only to green when its checked and to red when its unchecked.
not the whole row just the TICK mark to green
Member 12899279
10-May-19 6:21am
View
there are two actually four tables Student(S_ID(primary key)),Course(C_ID(Primary key)),StudentCourse((S_ID,C_ID(Foreign keys))Bridge table) and attendance table with (S_ID,C_ID(Foreign keys))
what i am doing is displaying data on datagridview by joining tables and slecting S_ID,S_Name,C_ID and Pre_Abs(Attendance table column)columns from all these tables now i want to insert the info present in datagridview to the attendance table when i click on button..i have done this already with simple insert query to attendance table by using datagrdview.rows[i].cell[2] property
i want to know if there,s any better idea to do this so that i can use JOIN instead of using datagridview property with for loop
for now my attendance table is empty while Student,Course,StudentCourse tables are filled with the data
what i want is to display record(S_ID,C_ID) from studentCourse table and (Pre_Abs) from Attendance table and when i submit the attendance i want it to store Pre_abs record against each S_ID,C_ID in the attendance table
i don't think i can explain it any further
Member 12899279
10-May-19 6:21am
View
there are two actually four tables Student(S_ID(primary key)),Course(C_ID(Primary key)),StudentCourse((S_ID,C_ID(Foreign keys))Bridge table) and attendance table with (S_ID,C_ID(Foreign keys))
what i am doing is displaying data on datagridview by joining tables and slecting S_ID,S_Name,C_ID and Pre_Abs(Attendance table column)columns from all these tables now i want to insert the info present in datagridview to the attendance table when i click on button..i have done this already with simple insert query to attendance table by using datagrdview.rows[i].cell[2] property
i want to know if there,s any better idea to do this so that i can use JOIN instead of using datagridview property with for loop
for now my attendance table is empty while Student,Course,StudentCourse tables are filled with the data
what i want is to display record(S_ID,C_ID) from studentCourse table and (Pre_Abs) from Attendance table and when i submit the attendance i want it to store Pre_abs record against each S_ID,C_ID in the attendance table
i don't think i can explain it any further
Member 12899279
9-May-19 20:41pm
View
insert into Attendance(S_ID,C_ID,Pre_Abs)
select a.Pre_Abs,sc.S_ID,sc.C_ID from Attendance a,StudentCourse sc
join Student s on s.S_ID=sc.S_ID
join Course c on c.C_ID=sc.C_ID
where sc.S_ID=2 and sc.C_ID=2
this is also not working
Member 12899279
9-May-19 20:31pm
View
Still not able to get what i want now i can select only those rows that match in both tables while i want to updte S_ID,C_ID,Date,Pre_Abs from Attendance table then i want to update it with the values that are selected and showed from StudentCourse table in datagridview in c#
Member 12899279
9-May-19 19:45pm
View
insert into Attendance
SELECT
StudentCourse.S_ID,
StudentCourse.C_ID
FROM StudentCourse
left JOIN Student on StudentCourse.S_ID = Student.S_ID
left JOIN Course on StudentCourse.C_ID = Course.C_ID
where StudentCourse.S_ID='2' and StudentCourse.C_ID='2'
this aint working either
Member 12899279
22-Dec-16 7:44am
View
Thanks for your kind help
Member 12899279
12-Dec-16 9:08am
View
Thanks for the help really appreciate it (Y)
Member 12899279
12-Dec-16 4:31am
View
thanks for the help but is there any way i can use it in de vcpp that has minwg32?i have only basic knowlege of classes functions constructor destructor etc...i dont know these terms api etc i have got the concept of what you have said but dont understand how to implement it in dev cpp mingw32 compiler
Show More