|
Thank you...
The wording in Express 2008 is "include directory", but I tried putting a filename there and it took it. Only thing is now I am basically down to one strange error stating it can't find /files/ibm/client.obj. There is no path on my computer called /files/ibm/, and there is no file called client.obj anywhere. So I will have to see if IBM has a forum where I can ask more specifically what I need to do, or if they have a newer library (since these files are quite old).
-Dan
|
|
|
|
|
as long as you have a support contract with IBM, these libraries should be easy to get updated ..
(if you dont then you may be 'stuck')
'g'
|
|
|
|
|
I need to read the text in the status bar of another application. The status bar class is Afx:StatusBar:400000.xxxx, so I guess it's the MFC CStatusBar object.
I have an existing piece of code that can read standard Windows status bars (class: msctls_statusbar32) fine. This piece uses SendMessage (SB_GETTEXT) as follows:
- Length=SendMessage(hStatusbar, SB_GETTEXTLENGTH, Index, 0); // Get the length of the text
- Allocate the buffer based on Length
- SendMessage(hStatusbar, SB_GETTEXT, Index, (LPARAM) Buffer);
// Index = the pane number of the status bar to retrieve the text
// Buffer = the place to store the text
(I've omitted all details about allocating memory in the remote process and copy data back and forth).
However, it doesn't seem to work with the Afx:StatusBar (as said earlier, it worked for msctls_statusbar32).
I would really appreciate it if someone could tell me how to get the text in CStatusBar.
Thanks a lot
|
|
|
|
|
Fisrt find the window with CWnd::FindWindow() (and CWnd::GetNextWindow)
then cast the CWnd pointer to CStatusBar*
then you can do anything you like to it!
Hope this helps you
www.logicsims.ir
|
|
|
|
|
Thanks a lot for your suggestion. Related to that:
1) If I already got a handle of that StatusBar, how can I cast it to a CStatusBar ?
2) Is there a non-MFC way to do it ? Right now, my project is non-MFC. So converting everything to MFC can be a deal breaker.
Thanks again.
|
|
|
|
|
you're welcome.
1)
CStatusBar* p = (CStatusBar*)CWnd::FromHandle(m_hWnd);
2) I'm sure can do it without MFC:
Find the window handle of it and then use ::GetWindowText()
Spy++ (Visual C++ tool) can read it's text, so you can
www.logicsims.ir
|
|
|
|
|
GetWindowText can only get text from the first pane. As I mentioned earlier, I already tried to send SB_GETTEXT to the CStatusBar control, but it didn't return anything.
|
|
|
|
|
Currently my c++ program sits on a recv() in the primary thread/loop. I want to be able to add one or more secondary threads that receive relatively low frequency data via tcp connections but want to immediately pass this information to the main thread. Is there a way I can signal the recv() in the primary thread to return via some mechanism initiated by any one of the secondary threads? Thought I could use waitformutlipleobjects but not clear how to set it up without moving the recv() functionality already in the main thread to a secondary thread.
Thanks
|
|
|
|
|
If you use WSARecv() with an OVERLAPPED structure instead of using recv() , the function will not block.
You can then wait on events using WaitForMultipleObjects or any of the other wait functions.
The secondary threads can then signal these events using SetEvent .
|
|
|
|
|
Not familiar with overlapped structure. Looked at a msdn example. Seems a bit complicated. Need to do a bit more research on this approach as well as let it settle in. If you can elaborate a bit more that would be appreciated.
Thanks
|
|
|
|
|
I have extracted the relevant code snippets from the MSDN example.
WSAStartup(MAKEWORD(2,2), &wsd);
ConnSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
connect(ConnSocket, ptr->ai_addr, (int)ptr->ai_addrlen);
WSAOVERLAPPED RecvOverlapped = {0};
RecvOverlapped.hEvent = WSACreateEvent();
WSABUF DataBuf;
char buffer[DATA_BUFSIZE];
DataBuf.len = DATA_BUFSIZE;
DataBuf.buf = buffer;
WSARecv(ConnSocket, &DataBuf, 1, &RecvBytes, &Flags, &RecvOverlapped, NULL);
WSAWaitForMultipleEvents(1, &RecvOverlapped.hEvent, TRUE, INFINITE, TRUE);
WSAGetOverlappedResult(ConnSocket, &RecvOverlapped, &RecvBytes, FALSE, &Flags);
The call will block on WSAWaitForMultipleEvents .
Any thread can signal the event on RecvOverlapped.hEven t.
|
|
|
|
|
okay. I'll see if I can get this to work. Thanks!
|
|
|
|
|
Hi guys,
Here I am again... But now with another problem :p
SHCreateDirectoryEx(NULL, "c:\\text", NULL); gives me the following error:
1>d:\app2\app2\Form1.h(302) : error C2664: 'SHCreateDirectoryExW' : cannot convert parameter 2 from 'const char [8]' to 'LPCWSTR'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
I found that _T("..") should work; giving me the following error:
1>App2.obj : error LNK2028: unresolved token (0A000028) "extern "C" int __stdcall SHCreateDirectoryExW(struct HWND__ *,wchar_t const *,struct _SECURITY_ATTRIBUTES const *)" (?SHCreateDirectoryExW@@$$J212YGHPAUHWND__@@PB_WPBU_SECURITY_ATTRIBUTES@@@Z) referenced in function "private: void __clrcall App2::Form1::saveButton_Click(class System::Object ^,class System::EventArgs ^)" (?saveButton_Click@Form1@App2@@$$FA$AAMXP$AAVObject@System@@P$AAVEventArgs@4@@Z)
1>App2.obj : error LNK2019: unresolved external symbol "extern "C" int __stdcall SHCreateDirectoryExW(struct HWND__ *,wchar_t const *,struct _SECURITY_ATTRIBUTES const *)" (?SHCreateDirectoryExW@@$$J212YGHPAUHWND__@@PB_WPBU_SECURITY_ATTRIBUTES@@@Z) referenced in function "private: void __clrcall App2::Form1::saveButton_Click(class System::Object ^,class System::EventArgs ^)" (?saveButton_Click@Form1@App2@@$$FA$AAMXP$AAVObject@System@@P$AAVEventArgs@4@@Z)
1>D:\App2\Debug\App2.exe : fatal error LNK1120: 2 unresolved externals
Does anyone have experience with this function. I want to make a (n absolute) folder and the OS where this will be written for is Vista (sorry - I might upgrade to W7 tho).
Could someone give me some hints?
Kind regards,
|
|
|
|
|
Try referencing shell32.lib in Additional Dependencies option of the project Linker properties.
If you're doing a C++/CLI application, you should be using Directory::CreateDirectory instead.
|
|
|
|
|
I got an application. So called Windows Forms Application.
I will try Directory::CreateDirectory.
Thanks again.
----------
Edit:
The IDE (Visual C++ Studio 2008 Express) cannot find Directory::CreateDirectory . I might to include some file I guess...
----------
Re-edit:
CreateDirectory("c:\test", NULL); works... Sort of - now I get the following error:
1>d:\app2\app2\Form1.h(304) : error C2664: 'CreateDirectory' : cannot convert parameter 1 from 'const char [7]' to 'LPCTSTR'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
modified on Friday, November 13, 2009 1:06 PM
|
|
|
|
|
You need to tell me if it is a managed or unmanaged application.
Do you see using namespace xxx or #include xxx on the top of the file?
And what are they?
|
|
|
|
|
Plentyyyyyy lol
#pragma once
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <algorithm>
#include "Serial/Serial.cpp"
#include "shlobj.h"
namespace App2 {
using namespace std;
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
using namespace System::Runtime::InteropServices;
|
|
|
|
|
CreateDirectory(_T("c:\\test"), NULL);
|
|
|
|
|
That works tho!
Thanks dude!
|
|
|
|
|
#include <shlobj.h>
int main(){
SHCreateDirectoryEx(NULL,"c:\\jinx",NULL);
return 0;
}
tested it with ms vc++ 2008. it works like charm
|
|
|
|
|
I am a beginner of c++. I have to do some image processing and computer vision. Can some one tell me if there is a function or library which is similar to imread in Matlab? Can you suggest me any book or useful resource for image processing in c++ ? I appreciate for helps,
Thank you
Mustafa ÖZENDİ
|
|
|
|
|
Image processing (other than loading and saving imaging) is an advanced topic and computer vision a bit more advanced, but can be fun to study because once you're able to do the basic operations, there's a world of fun stuff to do.
I assume imread is a function to load an image, so, you could use the CImage class to do that.
Other than that, I suggest googling a little bit; once you have more precise questions we'd be glad to help you more.
Good luck.
Max.
This signature was proudly tested on animals.
|
|
|
|
|
Check out the OpenCV library. It's currently being supported by Willow Garage.[^] There's a book about it "Learning OpenCV".[^]
You measure democracy by the freedom it gives its dissidents, not the freedom it gives its assimilated conformists.
|
|
|
|
|
I have an SDI MFC App, the CMainFrame has an in value that is to be displayed on the status bar
I have a OnUpdateWhat method with a CCmdUI * parameter the performs a test text using the value of the int
The value is modified from my CFormView member using the CMainFrame's public function modifyRecCount this function assigns the new value to the status bar value,
I am expecting to get the OnUpdateWhat called when the value of the status bar value field is changed but nothing happens...can anyone help?
|
|
|
|
|
Have you added ON_UPDATE_COMMAND_UI() to the message map? If so, have you set a breakpoint in the handler function to see if it's being called (which is only during idle processing)?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|