|
Hi all,
Simple function (cut down to not include all the other crap.
I have #included the winsock.h and included the wsock32.lib.
int GetIPAddresses()
{
char shostname[255];
int e = 0;
e=gethostname(shostname, sizeof(shostname));
struct hostent *pdata = ::gethostbyname(ashostname);
}
On compiling I get this error :
error C2143: syntax error : missing ';' before 'type'
Does anyone know what that is?
[EDIT]This is in C and not C++. I forgot to mention that.[/EDIT]
Cheers,
"If you're too careful, your whole life can become a f---in' grind." - Mike McD (Rounders)
|
|
|
|
|
Have you tried using the winsock2 stuff instead?
winsock2.h
and
ws2.lib
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Walliams (Little Britain)
|
|
|
|
|
Hi Ant,
Yes I have, and still the same error.
Cheers,
"If you're too careful, your whole life can become a f---in' grind." - Mike McD (Rounders)
|
|
|
|
|
I'm using a CRichEditView derived class for my view. When I drag a file from explorer over it's view and drop it I want to open the file if it is a text file otherwise tell the user it won't work. The default implementation is to draw a box representing the file.
What message should I be catching and any tips??
ed
|
|
|
|
|
Fount it!
ed
The absence of evidence is not evidence of absence.
|
|
|
|
|
im tasked with updating our suite of MFC apps (mostly dialog based stuff, one mdi app) and am looking into updating the look and feel. Specifically want a well documented gui/controls/widget library with reszeable customizeable toolbars, docking, nice grid, print preview, nice control library. Anyone have any recommendations ? or ones to avoid ?
thnx.
|
|
|
|
|
Dundas is pretty good but it doesn't look like they are advancing it now. Prof-UI is really good too. I use them together for the most part.
Stingray used to work real good but they are pretty expensive and not quite as easy.
ed
The absence of evidence is not evidence of absence.
|
|
|
|
|
Hi all:
How can I retrieve the FDT for specific folder!!
Thanks
|
|
|
|
|
again ?
I think that we don't know how to do that.
heck, I tried seaching MSDN, and I'm not even sure what to look for ?
What exactly are you trying to do ?
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Sorry! If this frequent appearing message bothering you!
I'm exhausted with file ordering methods!It seems the previous method(firt copied file list ahead) simply works but to a extent where I can't accept It's stableness. So I turn to FDT. I just used WinHex(a tool) to check the folder that contain many music files. When I get to that folder's cluster, the contents(the file name contained in that folder) at that cluster for which WinHex display is the exact order that appearing after the execution of DOS command "dir".
So I try my best to manipulate FDT to achieve my goal!It's probably my last resort!
Oh,BTW I should make its application clear. What I'm trying to do is specify the music files playing order for MP3 player!Its order is correspondent to the order appear after "dir"!So...it all begin!!
|
|
|
|
|
I still don't understand why the order given by "dir" is so important to you, and not the order given by FindFirstFile/FindNextFile ?
Why don't you let the user specify in what order the files will be played ( like all other mp3 players in existence ) ?
One other way would be to execute the "dir" command and catch its output, and parse it for the filenames.
me think that going deep in the filesystem to find the "File Directory Table" just to have an ordered file list is WAY overkill.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
All just because the music files playing order for the most MP3 player is rely on the order appear after "dir"!But the command "dir" itself has nothing to do with it!
You're right going deep into the filesystem is WAY(is this word a adj or a acronym, just out of language learning prupose) overkill!
I just found that the reason for the unstableness of the previous method is if you rename a file it will not change it's order unless it contain space or long name! Hope that fact can save me, working on it currently!
Thanks for your patience anyway!I appreciate it!
|
|
|
|
|
kwib799 wrote:
All just because the music files playing order for the most MP3 player is rely on the order appear after "dir"!But the command "dir" itself has nothing to do with it!
Most ( if not all ) mp3 players rely on internal playlists; not actually what is on disk; if a file changes between execution of the mp3 player, the playlist entry will be marked as "bad" when the user will try to play the file. There are multiple ways of handling this, for example, iTunes will not see bad files until the user access the file ( either playing, editing the tags, ... ), it makes loading the application faster , and will ask the user to act up to either remove the internal entry or find the actual file. on other software that I use, Traktor will scan the disk to check the consistensy of its database, load time of the application can take a long time, but all "bad" files will be reported/marked and the user can see and fix them without having to "guess" which one changed.
(edit)
( the above is partially true ... too early to think straight ... )
I think that most mp3 players ( iTunes, WMP, Winamp, ... ) will use metadata tags internally, either ID3 tags for mp3 files or some other formats ( for wma, aac, ogg, ... ).
kwib799 wrote:
I just found that the reason for the unstableness of the previous method is if you rename a file it will not change it's order unless it contain space or long name! Hope that fact can save me, working on it currently!
huh ? if I rename a file and do a dir it will put the rename in its good alphabetical place.
I you always load the file list from what is in the directory, renaming a file will change its order and be shown.
If you rename the file externally while your program is running, then, I agree, your player will not be able to play the file, because its internal list will not match its own file name with what is on disk.
If you need to "watch" filess in a directory, there is a API that will notify you when that happens.
( I think the API is FindFirstChangeNotification and related functions ).
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
I need to make a program that uses fxxxx (fopen, ftell, fseek, fread, etc...) functions to support >2gb files. How would I do that? I see _fseeki64.c and _ftelli64.c in crt\src\, but can't figure out how to use those functions in my program (no matter what I do, I get an unresolved external symbol error). A Google search on those functions turns up virtually nothing
|
|
|
|
|
I think you'll need to move to the Win32 API functions CreateFile, SetFilePointer, and ReadFile... You can look these up in the Docs.
onwards and upwards...
|
|
|
|
|
I actually finally got it working, by putting
extern "C" int __cdecl _fseeki64(FILE *, __int64, int);<br />
extern "C" __int64 __cdecl _ftelli64(FILE *);
in my header .
|
|
|
|
|
Hello, I am newbie to Visual C++ / ATL Programming with a question:
I have a toolbar class in which I have an instance of IWebBrowser2 that is used by the toolbar to naviagate Internet Explorer to various urls. I also have a seperate hyperlink function, not part of any class, that converts static controls into hyperlinks. The hyperlink function catches whenever the hyperlinked static control is clicked. I need to do it so that whenever the control is clicked, the current url is grabbed and something is done with it by the event in the hyperlink function. I have tried to create another instance of IWebBrowser2 in the hyperlink function and then use the get_LocationUrl to try to get the current Url, however there is a runtime error. Please help.
Thanks in advance.
|
|
|
|
|
Hello! - I’d be really glad to learn how serial com port communication is done using Visual C++.NET and Visual Basic.NET as I’m going to create an application where a master desktop/laptop PC communicates Modbus RTU protocol with external slave devices. My (beginner’s) questions are:
1. How is serial com port communication done using Visual C++.NET and Visual Basic.NET respectively (according to Microsoft)?
2. Which of Visual C++.NET or Visual Basic.NET would be the more suitable language for a serial com port Modbus communication application like this?
3. Is there any comprehensive literature dealing with serial com port communication using Visual C++.NET and Visual Basic.NET (maybe even Modbus specifically)?
4. Are there any good sites where source code for Visual C++.NET and Visual Basic.NET serial com port communication (maybe even Modbus specifically) can be downloaded/bought?
|
|
|
|
|
Try searching Code Project on the word 'serial'. The search is available at the top of the page, just beneath Bob and the Code Project logo.
Software Zen: delete this;
|
|
|
|
|
I need to pass a small user data to each tab I create in my tab control.
I do something like :
...
typedef struct Dummy
{
CString s;
} MaxDummy;
...
TCITEM tcItem;
tcItem.mask = TCIF_PARAM| TCIF_TEXT;
tcItem.pszText = _T("Allo");
tcItem.cchTextMax = 255;
tcItem.iImage = 0;
MaxDummy* p = new MaxDummy;
p->s = _T("Salut");
tcItem.lParam = (LPARAM) p;
m_TabCtrl.InsertItem( 0, &tcItem );
the question related to the GetItem ... in MSDN, it says that I need to create a different structure than TCITEM ( see CTabCtrl::GetItem At MSDN[^] )
I don't understand what they mean by that ? is it if I need to pass 2 values to the lParam ?
if I create my own struct and "new" it, and pass the pointer to the lParam, is that sufficient ?
...
TCITEM tcItem;
tcItem.mask = TCIF_PARAM;
tcItem.cchTextMax = 0;
tcItem.pszText = NULL;
tcItem.lParam = NULL;
(void)GetItem(0, &tcItem);
MaxDummy* p = (MaxDummy*)tcItem.lParam;
CString s = p->s;
...
The problem I have is that the struct I pass to the lParam seems to be corrupt at some point ... and I thought I missed something obvious ...
Thanks in advance, maybe I will figure it out just when I step out of my office ...
Max.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
You'll have crap in dwState and dwStateMask
Add:
ZeroMemory( &tcitem, sizeof(TCITEM));
See Blake Miller reply below re. LVITEM.
Neville Franks, Author of ED for Windows www.getsoft.com and Surfulater www.surfulater.com "Save what you Surf"
|
|
|
|
|
I've created a list control that lists all my threads that are created.
When a thread is created I'm storing the m_nThreadID in the LPARAM for that item in the list. Example:
<br />
int nCount = m_lClientConn.GetItemCount();<br />
CString strItem;<br />
strItem.Format(_T("Connecting"));<br />
<br />
for (int i = 0; i < nCount; i++)<br />
{<br />
CMyThread* thread = (CMyThread *)AfxBeginThread(RUNTIME_CLASS(CMyThread), THREAD_PRIORITY_NORMAL, 0, CREATE_SUSPENDED);<br />
thread->IPaddress = m_lClientConn.GetItemText(i, 0);<br />
thread->IPport = m_lClientConn.GetItemText(i, 1);<br />
thread->thdID = m_lClientConn.GetItemText(i, 2);<br />
thread->ConnID = i;<br />
thread->myHandle = this;<br />
thread->ResumeThread();<br />
<br />
LVITEM lvItem;<br />
lvItem.iItem = i;<br />
lvItem.iSubItem = 3;<br />
lvItem.mask = LVIF_TEXT|LVIF_PARAM;<br />
lvItem.pszText = (LPTSTR)(LPCTSTR)(strItem);<br />
lvItem.lParam = (LPARAM)thread->m_nThreadID;<br />
m_lClientConn.SetItem(&lvItem);<br />
}<br />
My problem is that I cannot seem to get this to work. I did have it working with the remed out call to SetItem, as to writing out the text "Connecting" but it did not set the threadID.
I need this ID to later Post a thread message to that particular thread.
Does anyone have any suggestions? Am I missing something?
Thanks
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
Some of the other fields imply setting/getting.
Especially the state and stateMask fields.
When I run into situations such as yours, my first reaction is to usually start with a 'known' state for my data.
So... I suggest something like this:
LVITEM lvItem;<br />
ZeroMemory( &lvItem, sizeof(LVITEM));<br />
lvItem.iItem = i;<br />
lvItem.iSubItem = 3;<br />
lvItem.mask = LVIF_TEXT|LVIF_PARAM;<br />
...etc...
|
|
|
|
|
I'm new to programming and am having trouble figuring out what the following syntax means when defining a function and it's arguments:
VOID myFunc(
IN PCHAR stuff,
OUT BOOLEAN test
);
What is the purpose of IN, OUT? What is this called? I haven't been able to find a good explanation because these are such common words, and I'm not sure what this syntax is called.
Thank you.
|
|
|
|
|
IN means that is something your passing to the function. OUT is something that will return from the function.
Laymans terms
Tom Wright
tawright915@yahoo.com
|
|
|
|