|
nothing is getting displayed in the combo box if i put the piece of code which u gave me.
|
|
|
|
|
That is awesome... that is a test code.
Anyway can you please show me the code segment? I need to know where and how you used it.
- NS -
|
|
|
|
|
it is working. but it is giving all the files and directories that is available in C. my requirment is not that. for example if there are 4 drives..ie(A,C,D,E). i need to print that A.C.D.E in the combo box. nothing else.
|
|
|
|
|
What I gave you is only an example. You can call it for any drive. Each call will add the list of directories to the existing list in the combo. If you need to get all the directories, as I said earlier, use CFileFind class recursively.
If you need only drives, specify the attribute as DDL_DIRECTORY.
- NS -
|
|
|
|
|
NS17 wrote: If you need only drives, specify the attribute as DDL_DIRECTORY.
Wrong. You should use DDL_DRIVES if what you want are drives.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
DavidCrow wrote: You should use DDL_DRIVES
Ooops... That's what I intended... Sorry for my careless typing (copy-pasting).
- NS -
|
|
|
|
|
Chandrasekharanp wrote: i need to print that A.C.D.E in the combo box.
These are drive designators, not directories (as your subject implies).
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Send it a CB_DIR message. Use DDL_DIRECTORY | DDL_EXCLUSIVE for the WPARAM argument. If you are using MFC, the solution is even simpler.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
yes i am using MFC. how will i do it in MFC??
|
|
|
|
|
Did you overlook this?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Can we get the starting date from which history of IE is displayed in the history folder programatically.
|
|
|
|
|
FindFirstUrlCacheEntryEx/FindNextUrlCacheEntryEx specify URLHISTORY_CACHE_ENTRY, you'll have to check every entry and examine the times in the INTERNET_CACHE_ENTRY_INFO to find the earliest time.
|
|
|
|
|
Hi,
How to identify the already created application is SDI/MDI/Dialog based.
Thanks in advance
|
|
|
|
|
shir_k wrote: How to identify the already created application is SDI/MDI/Dialog based.
An option could be to check main window class using GetClassName.
AfxGetMainWnd()->GetClassName()...
Nibu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http:\\nibuthomas.wordpress.com
|
|
|
|
|
Hi,
I've used the CTaskbarNotifier (found here) class in my project to show taskbar notifications. It works fine on Windows XP, but I've just seen that it's not so fine on Vista... The notifications have an ugly border.
You can see it on screenshots:
XP: http://alaf.sierp.net/xp.jpg
Vista: http://alaf.sierp.net/vista.jpg
Any idea how to get rid of that border?
Cheers,
Maciej
-- modified at 8:46 Monday 15th October, 2007
To be more specific:
The windows is created with the WS_POPUP style:
CreateEx(0,strWndClass,NULL,WS_POPUP,0,0,0,0,pWndParent->m_hWnd,NULL);
One thing comes to my mind, I don't have the Platform SDK for Vista, I am using the previous one, for Windows XP. Could the lack of Vista SDK be causing incorrect styling?
|
|
|
|
|
This is not really language specific but more of a source code parsing.
I have a large ASP source file that I like to split up, resulting in separate ASP files, each containing one function and the filename named after that function.
Does anyone know of a tool/script which does this?
PS: I am too lazy to learn Perl/AWK/Python to do this, hence why I believe someone has already written a tool/script to do this. Possibly in C++/etc.
|
|
|
|
|
Hi,
I'm reading documentation about Libraries and how to load, detach them. But I have some concept doubts about.
I have a point in my program where I have to use some functions that should be programmed in a Dll to avoid having that functions in computers where we have not delivered this dll. So when needed, the user should click on a button and search the dll. If the dll is there, then I save the returned name/path of the CFileDialog and set a variable like "m_bLibraryLoadedOK". Afterwards, when the other button is pressed and depending on that bool, I give an error message or use the LoadLibrary function with the saved name/path, use the function I will have in the DLL, and when all is ready... I want to unload the library.
And it now is where I have the doubts.
For example I don't correctly understand the bold part in the following quote: "The Visual C++ compiler supports a syntax that enables you to declare thread-local variables: _declspec(thread). If you use this syntax in a DLL, you will not be able to load the DLL explicitly using LoadLibrary or LoadLibraryEx. If your DLL will be loaded explicitly, you must use the thread local storage functions instead of _declspec(thread)."
The function in the dll is going to need just one variable from my main programm, a pointer/reference to a buffer with the data that have to be written in the PLC. All the other things (if needed) will be local. Should I worry about the quote above? What „key words“ should I look for?
And…
When I load the dll. Is a thread being automatically created? Will the FreeLibrary enough at the end of my function to unload the library? Or will I have to use more things (Like the DLLMain )??
Any tip or Keyword to look for and help me undertand the thema will be apreciated.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
Nelek wrote: When I load the dll. Is a thread being automatically created?
No. You can load and call functions in a Dll on the same single main thread of your program. Use of Dlls doesn't require multiple or secondary threads, it's just function calls.
Nelek wrote: Will the FreeLibrary enough at the end of my function to unload the library?
Yes. You can't gaurentee Windows will actually unload it, Windows is lazy but it makes no difference, you can treat it as having been unloaded.
Nelek wrote: Should I worry about the quote above?
No. Not in this case. It only affects variables declared in the Dll with __declspec(thread) where the Dll doesn't have it's own statically linked copy of the C Library, i.e. it isn't already linked with LIBCMT or one of ts variants before you use it.
The explanation of this is that __declspec(thread) inserts an entry in a special data table that is used by the C Library startup routines to setup up Thread Local Storage variables. If the C Library startup doesn't run after your Dll is loaded because it dones't have it's C Library instance then this initialisation never happens and your __declspec(thread) variables are invalid.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
Thank you for the good answer.
The code to read is already working in my program. I just have to code it in the dll and make the loading dinamically. With your answer and two articles I found in the site, I am not so afraid about doing it.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
Hi,
I need to remove Cut,Copy Permissions for a folder.Any Suggestions or links would be helpful.
Thanks
Today is a gift, that's why it is called the present.
|
|
|
|
|
This would require removing both read and write permissions from the folder. You can do this by adding that type of ACE to the folder's ACL.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi,
Thanks for the response.
What I want exactly is to Open the folder and view the contents , and play any files in that folder like Windows Media Player.But I dont want the contents of the folder to be copied or cut.
I did as you said by removing read and write permissions but gave Execute permission and I am getting "Access is Denied" when I try to open the File.
So, I am not sure of the permissions I have to give to folder.Any Suggestions would be helpful.
Thanks in Advance.
Today is a gift, that's why it is called the present.
|
|
|
|
|
hi,
I am a beginner in C++. now I was writing the MFC( dialog based)program for the RFID interfacing. My existing program is upon clicking the start button, it will send the command to the reader and receive the response from it by using serial commnunication within for loop and serial port will disconnect by clicking stop button at the end of 'for' loop. If I click the stop button while program running half way, the program will hang. So, I wanted to implement it that upon clicking start button, my program will start interfacing with reader continuously until I clicked the stop button.So, how can i do it and can support me the sample source code for this similar program?
thanks,
Thinn
This is a part of my existing program
void CTry2Dlg::OnStart()
{
// TODO: Add your control notification handler code here
// ***
char c[40],bcch;
int bcc,ent=0;
int h=0,count=0;
com = new Tserial();
com->connect("COM2", 9600, spEVEN);
char command[15] = {0x02,0x30,0x30,0x52,0x44,0x4D,0x54,0x41,0x41,0x30,0x30,0x30,0x31,0x03};// multi
bcc=com->bcc(command); // obtain BCC
bcch=bcc;
for(int n=0;n<10;n++)
{
GetTime();
for(int i=0;i<15;i++) // send command
{
if(i==14)
{
com->sendChar(bcch);
}
else
{
com->sendChar(command[i]);
}
}
GetDlgItem(IDC_Status)->SetWindowText(command);
GetDlgItem(IDC_Status)->UpdateWindow();
// Sleep(100);
count=0;
do // read response frame
{
h=0;
c[h] = com->getChar();
while(c[h]!=0x03) // to detect ETX of reponse frame
{
h++;
c[h] = com->getChar();
}
// if(c[h]==0x03)
// {
count++;
// }
c[h] = com->getChar(); // BCC
if(c[6]==0x37 && c[7] ==0x32) // check for end of detection
{
ent=1; // endofTx
// if(count>1)
// {
count--;
// }
}
else // more to come ...
{
ent=0;
//cout<<endl<<"uid =="" ";
char="" temp[16];
for(int="" k="8;k<24;k++)
{
temp[k-8]=c[k];
}
CString" appendtext;
getdlgitem(idc_tag)-="">GetWindowText(appendText);
appendText += temp;
appendText += "\r\n";
GetDlgItem(IDC_Tag)->SetWindowText(appendText);
GetDlgItem(IDC_Tag)->UpdateWindow();
}
}while(ent==0); // reading
CString text;
text.Format("%d", count);
GetDlgItem(IDC_Counter)->SetWindowText(text);
GetDlgItem(IDC_Counter)->UpdateWindow();
Sleep(2000);
Clear();//clear the edit boxes
}
}
void CTry2Dlg::OnCancel()
{
// TODO: Add extra cleanup here
CDialog::OnCancel();
}
void CTry2Dlg::OnStop()
{
com->disconnect();
CString text=" ";
GetDlgItem(IDC_Counter)->SetWindowText(text);
GetDlgItem(IDC_Counter)->UpdateWindow();
GetDlgItem(IDC_Tag)->SetWindowText(text);
GetDlgItem(IDC_Tag)->UpdateWindow();
GetDlgItem(IDC_Status)->SetWindowText(text);
GetDlgItem(IDC_Status)->UpdateWindow();
}
--
|
|
|
|
|
yah, i got your problem.
but before answering it, i want you to advice that, you donot need to paste the whole code here, because, most of the readers donot prefer read such a big posts. your post should be as simple as possible, and reflecting your actual problem.
and to your question, since, you have defined all your port related code in a single function, i.e. button, your screen (dialog) will not get the focus until the function gets completed.
so the solution is, you have to define this code in a thread, start the thread in the start button and kill it in the stop button.
any more doubts,
you are welcome.
Suggestion to the members:
prefix your main thread subject with [SOLVED] if it is solved.
chandu.
|
|
|
|
|
I'm rather new to this forum,thx for ur advice and i will take note on that. i am new to C++ and i have tried to read through the "instuction to create threading" but i still find it hard to understand. So i greatly appreciate ur help
Thx alot for ur help. =)
--
|
|
|
|